Instructions:
This Excel template contains a VBA script for logging into the Grameenphone Bulk SMS website and extracting data.
To ensure security, please manually enter your username and password into the VBA code as needed.
Website URL: https://gpcmp.grameenphone.com/#/login
Username: JHORAdmin
Password: @Jh0r0123@$0
Follow these steps:
1. Press Alt + F11 to open the VBA editor.
2. Copy and paste the VBA code below into a new module.
3. Replace the username and password in the code as shown in the comments.
4. Run the macro to login and extract data.
Here is the VBA Code:
Sub WebLoginAndScrape()
Dim ie As Object
Dim html As Object
Dim usernameField As Object
Dim passwordField As Object
Dim loginButton As Object
Dim url As String
' Initialize Internet Explorer
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True ' Set to True to see the browser
' Set the URL for the website you want to log into
url = "https://gpcmp.grameenphone.com/#/login"
' Navigate to the login page
ie.navigate url
' Wait for the page to load
Do While ie.Busy Or ie.readyState <> 4
DoEvents
Loop
' Set the HTML document object
Set html = ie.document
' Find and fill in the username and password fields
Set usernameField = html.getElementById("username") ' Replace with actual ID
Set passwordField = html.getElementById("password") ' Replace with actual ID
' Input the username and password
usernameField.Value = "JHORAdmin" ' Replace with actual username
passwordField.Value = "@Jh0r0123@$0" ' Replace with actual password
' Find and click the login button
Set loginButton = html.getElementById("loginButton") ' Replace with actual button ID
loginButton.Click
' Wait for the page to load after logging in
Do While ie.Busy Or ie.readyState <> 4
DoEvents
Loop
' Extract data or navigate further as needed
' Example: Navigate to another page and scrape the data
' Close Internet Explorer
ie.Quit
MsgBox "Data Updated Successfully!"
End Sub