Hello All,
I am trying to access a webpage and update the user name and password, but unable to get the getElementById
I tried the similar code with google and yahoo, they work perfectly. Below is the code I'm using
Sub Openurl()
Dim IE As Object
Dim IEPage As Object
Dim IEPageElement As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate URL
' The below piece of code also does not work
Do Until IE.readyState = 4 'READYSTATE_COMPLETE in early binding
DoEvents
Loop
Set IEPage = IE.Document
Set IEPageElement = IEPage.getElementById(cwsUID)
If Not IEPageElement Is Nothing Then
IEPageElement.Value = UserName
Set IEPageElement = Nothing
Else
MsgBox "Coould not find the '" & UNElementID & "' element ID on the page!", vbCritical, "Element ID Error"
Exit Sub
End If
End Sub
--------------------------------------------------
Kindly let me know if there is something wrong with this code.
Bookmarks