Hi guys, I need advice for VBA on how to login to a secured website.
The website is "https://www.creditbureau.com.sg/cgi/main"
I read some discussions on how to login to simple websites where username and password fields can be access using the Input_Text box's name and then append .value = "username", so on for password.
What do I have to code in VBA to access a secured site as mentioned above, when a login box appears?
*Assume that
Username is Jf18
Password is Pass99
======
I did something like this below. As you see, the website requests for username and password in a windows pop up form. How do I access that ?
-Start Code-
Dim HTMLDoc As HTMLDocument
Dim myBrowser As InternetExplorer
Dim iHTML_Element As IHTMLElement
Dim sURL As String
Sub SecuredSiteAccess()
On Error GoTo Err_Clear
sURL = "https://www.creditbureau.com.sg/cgi/main"
Set myBrowser = New InternetExplorer
myBrowser.Silent = True
myBrowser.timeout = 60
myBrowser.navigate sURL
myBrowser.Visible = True
Do
' Wait till the Browser is loaded
Loop Until myBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = myBrowser.document
'Pseudo Password used
IE.document.all("UserNameControl").Value = "Jf18"
IE.document.all("PasswordControl").Value = "Pass99"
IE.document.all("Submit Button").Click
Err_Clear:
If Err <> 0 Then
'Debug.Assert Err = 0
Err.Clear
Resume Next
End If
End Sub
-End Code-
Bookmarks