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. I have also set the HTML object library. Can I get some advice. Here is my code. Thanks

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)

Dim doc As HTMLDocument
Set doc = WebBrowser1.Document
doc.All("btnAcknowledge").Click

End Sub