Hello guys...
I new to vba, I think its a minor issue that I have going on.
When I execute the code below, I get error "91" - Object variable or With block variable not set.
I need the code to click the button "ENTRAR."
Going at the page link: http://autorizadorintermedica.starti...spx?ans=359017 you can see the page code. I located the following name for the button: "ctl00$cphBody$LoginButton" - I think this should be correct. I just cant understand why I get an error.
Thanks a lot in advance!!!
Sub Test_IAMSPE_()
Const cURL = "http://autorizadorintermedica.startiss.com.br/Login.aspx?ans=359017"
Const cUsername = "12345" 'Enter your user name here
Const cPassword = "99999" 'Enter your Password here
Dim IE As InternetExplorer
Dim doc As HTMLDocument
Dim LoginForm As HTMLFormElement
Dim UserNameInputBox As HTMLInputElement
Dim PasswordInputBox As HTMLInputElement
Dim SignInButton As HTMLInputButtonElement
Dim HTMLelement As IHTMLElement
Set IE = New InternetExplorer
IE.Visible = True
IE.Navigate cURL
'Wait for initial page to load
Do While IE.ReadyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
Set doc = IE.Document
Set LoginForm = doc.forms(0)
Set UserNameInputBox = LoginForm.elements("ctl00$cphBody$txbUserName")
UserNameInputBox.Value = cUsername
Set PasswordInputBox = LoginForm.elements("ctl00$cphBody$txbPassword")
PasswordInputBox.Value = cPassword
Set SignInButton = LoginForm.elements("ctl00$cphBody$LoginButton")
SignInButton.Click ' I GET AN ERROR HERE
'Wait for the new page to load
Do While IE.ReadyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
IE.Visible = True
End Sub
Bookmarks