PDA

View Full Version : Filling out web form



Phitur
10-04-2010, 12:47 PM
I'm having some trouble filling out a web form on an intranet page. I need to check a radio button to allow output in .xls form, select the appropriate data from a drop down box (in this case "Product") and open a spreadsheet that I can automatically switch focus to.

I haven't gotten to the spreadsheet yet, still trying to get the webform to populate. The radio button has two options. The default is the first and I want the second, "xls".

The code is giving me an error on the the first myIE.document line with "Method 'Document' of object 'IWebBrowser2' failed". Any help would be most appreciated.


Sub Macro2()
Dim myIE As Object
Set myIE = CreateObject("InternetExplorer.Application")
myIE.Visible = True
myIE.navigate URL:="internal web page"
Do Until myIE.readyState <> 1: DoEvents: Loop
myIE.document.getElementById("output_target").Value = "xls"
myIE.document.getElementById("cyber_resource_select").Value = "Product"
myIE.document.forms(0).submit
End Sub

Thanks