Hey guys, I'm hoping someone can help me out here. I'm manipulating a webform with a userform for work. I'm getting a Run time error 91: "Object Variable or With block variable not set." on the highlighted line of code.
When I step through the code I don't get the error. It's only when I try to run the code. Any ideas?
Code:
Set IE = New SHDocVw.InternetExplorerMedium
IE.Visible = True
IE.Navigate Nav
Do
DoEvents
Loop Until IE.ReadyState = READYSTATE_COMPLETE
Set WF = IE.Document
With WF
.getElementById(SType).selectedIndex = Me.ListBox1.ListIndex + 1
.getElementById(SType).FireEvent ("onchange")
End With
Do
DoEvents
Loop While WF.getElementById(CROList) Is Nothing
Set e = WF.getElementById("ListBox1")
i = 0
For Each o In e.Options
If o.Value = Me.TextBox2.Text Then
e.selectedIndex = o.Index
e.FireEvent ("onchange")
Exit For
End If
i = i + 1
If i > e.Length Then
MsgBox "Sample was not found."
Exit For
End If
Next o
Do
DoEvents
[COLOR=#FF0000]Loop Until WF.getElementById("btnAccept").Disabled = True
[/COLOR]
If Me.CheckBox1.Visible = True Then
If WF.getElementById("Incl_Daily_Average").Checked = True Then
Me.CheckBox1 = True
Else
Me.CheckBox1 = False
End If
End If
IE.Quit
Set IE = Nothing
When I step through the code I don't get the error. It's only when I try to run the code. Any ideas?