Hello,
I am getting the following error message
Run-time error '91': Object variable or With block variable not set.
Here's my code, and the line highlighted in red is where the error message occurs
Here's the html behind the radio button which I am trying to select.
any ideas where I'm going wrong?
Thanks
I am getting the following error message
Run-time error '91': Object variable or With block variable not set.
Here's my code, and the line highlighted in red is where the error message occurs
Code:
Public Sub Login()
Dim IE As InternetExplorer
Dim HTMLdoc As HTMLDocument
Dim button As HTMLInputButtonElement
Dim i As Integer
Set IE = New InternetExplorer
With IE
.Visible = True
.navigate "URL"
While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = .document
End With
Set UserName = HTMLdoc.getElementById("ctl00$ContentBody$LoginControl1$txtUserName")
Set Password = HTMLdoc.getElementById("ctl00_ContentBody_LoginControl1_txtPassword")
UserName.Value = "Username"
Password.Value = "Password"
Set SignIn = HTMLdoc.getElementById("ctl00_ContentBody_LoginControl1_butLogon")
SignIn.Click
'Choose Site
While IE.Busy Or IE.readyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set button = Nothing
i = 0
While i < HTMLdoc.Links.Length And button Is Nothing
If InStr(HTMLdoc.Links(i).href, "ctl00$ContentBody$rptSites$ctl00$ctl00") > 0 Then Set button = HTMLdoc.Links(i)
i = i + 1
Wend
If Not button Is Nothing Then
button.Click
Else
MsgBox "Button not found"
End If
'Choose what you want to do in SoftSmart
While IE.Busy Or IE.readyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set button = HTMLdoc.getElementById("linkMailMerge")
button.Click
'Choose detailed data extract
While IE.Busy Or IE.readyState <> READYSTATE_COMPLETE: DoEvents: Wend
[COLOR=#ff0000][B] HTMLdoc.getElementById("rdoDetailedExtract").Checked = True
[/B][/COLOR]
End Sub
HTML:
Thanks