Option Explicit
Sub IE_login()
Dim ie As InternetExplorer
Dim C
Dim ULogin As Boolean, ieForm
Dim MyPass As String, MyLogin As String
redo:
MyLogin = Application.InputBox("Please enter your VBAX login", "VBAX username", Default:="login", Type:=2)
MyPass = Application.InputBox("Please enter your VBAX password", "VBAX Password", Default:="Password", Type:=2)
If MyLogin = "" Or MyPass = "" Then GoTo redo
Set ie = New InternetExplorer
ie.Visible = True
ie.Navigate "http://www.vbaexpress.com"
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
For Each ieForm In ie.Document.forms
If InStr(ieForm.innertext, "Password") <> 0 Then
ULogin = True
ieForm(0).Value = MyLogin
ieForm(2).Value = MyPass
ieForm.submit
Exit For
Else
End If
Next
If ULogin = False Then MsgBox "User is aleady logged in"
Set ie = Nothing
End Sub
Sub SetRefs()
Dim ObRef
On Error Resume Next
ThisWorkbook.VBProject.References.AddFromGuid "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 1, 1
End Sub
|