I am amature VBA programmer. I am working in a small automation. The steps are
- Open a IE browser
- Navigate to a webpage
- Logon using my username and password
I am using below excel VBA code to get my solution
Code snippet
Sub LoginAuto()
Dim Myhtml As IHTMLElement
Dim Myurl As String
Myurl = "http://myurl.com"
Set Mybroswer = New InternetExplorer
Mybroswer.Silent = True
Mybroswer.navigate Myurl
Mybroswer.Visible = True
Do
Loop Until Mybroswer.readyState = READYSTATE_COMPLETE
Set HTMLDOC = Mybroswer.document
HTMLDOC.all.UserName.Value = "myuser"
HTMLDOC.all.Password.Value = "mypassword"
For Each Myhtml In HTMLDOC.getElementsByTagName("button")
If Myhtml.Type = "submit" Then
Myhtml.Click:
End If
Exit For
Next
End Sub
while running above program i am getting below error
excel vba automation error the object invoked has disconnected from its clients