Marker5150
New Member
- Joined
- Oct 30, 2014
- Messages
- 2
I want to login to the IBM ISM web page using VBA- this is done while at work. The code below works with some pages but throws an error with this webpage. I get an error on the MyBrowser.Visible = True statement. Is it because it's a Javascript webpage? And if so, is there a way around it.
Here's my code:
Sub ISMlogin()
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear
MyURL = "http://usmdlcsvci305.jvservices.com/maximo/webclient/login/login.jsp?appservauth=true"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.Navigate MyURL
MyBrowser.Visible = True 'This is where the first error occurs "Automation error. The interface is unknown.
Do
Loop Until MyBrowser.ReadyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.Document
HTMLDoc.all.UserName.Value = "xxxxxx" 'Enter your user id here
HTMLDoc.all.Password.Value = "xxxxx" 'Enter your password here
For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
If MyHTML_Element.Type = "submit" Then MyHTML_Element.Click: Exit For
Next
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
Here's my code:
Sub ISMlogin()
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear
MyURL = "http://usmdlcsvci305.jvservices.com/maximo/webclient/login/login.jsp?appservauth=true"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.Navigate MyURL
MyBrowser.Visible = True 'This is where the first error occurs "Automation error. The interface is unknown.
Do
Loop Until MyBrowser.ReadyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.Document
HTMLDoc.all.UserName.Value = "xxxxxx" 'Enter your user id here
HTMLDoc.all.Password.Value = "xxxxx" 'Enter your password here
For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
If MyHTML_Element.Type = "submit" Then MyHTML_Element.Click: Exit For
Next
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub