I am new to vb6. I am trying to automatically click a button on a web age. I keep getting the run-time error 91, object variable or With block variable not set at the line doc.All("btnAcknowledge").Click. I have also set the HTML object library. Can I get some advice. Here is my code. Thanks


Private Sub cmdGo_Click()
WebBrowser1.Navigate ("http://....com/")
End Sub

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Dim doc As HTMLDocument
Set doc = WebBrowser1.Document
doc.All("btnAcknowledge").Click
End Sub

doc.All("btnAcknowledge").Click

Is there an element in your 'doc' named btnAcknowledge that's probably the error, you're trying to access the btnAcknowledge which was not set.

The html document contains <input type="submit" name="btnAcknowledge" value="I Acknowledge That I Have Read This Description" id="btnAcknowledge" />

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.