I have been trying to login to a website from within vba but was not succeful,
I have tried many variations of the following code
Sub TestIE()

Dim oIE As InternetExplorer
Dim ieForm
Dim i As Long

Set oIE = New InternetExplorer
oIE.Visible = True
oIE.navigate "url"
Do Until oIE.readyState = READYSTATE_COMPLETE: Loop

With oIE.document
.forms("login").all("AccessCard").value = "jujj"
.forms("login").all("Webpassword").value = "jjj"
End With

Set oIE = Nothing
Set ieForm = Nothing

End Sub
Currently I am getting
Runtime error 91
Object Variable or With block variable not set
right at the line indicated above
any idea why?


I found many ways to do that online but they all resulted in errors.

thanks a lot