Preface: I am programming via the VBA code window of Excel 2002.
I've added Microsoft Internet controls and Microsoft HTML object library to the project references.
So far this works:
Dim web As WebBrowser
Private Sub FormLoad()
Set web = New WebBrowser
Set web = CreateObject("internetexplorer.application")
web.Navigate2 "http://blahblahblah.com/"
web.Visible = True
End Sub
Private Sub FillForm()
web.Document.Forms(0).EMP__NO.Value = "111111"
web.Document.Forms(0).PASSWORD.Value = "password"
End Sub
FormLoad launches IE to the appropriate web site.
FillForm fills in the 2 fields of the form.
I am stumped as to how to programmically hit the submit button. I tried adding the following line to the FillForm Sub with varying results.
web.Document.Forms(0).submit
VB is waiting for an invalid/missing method
web.Document.Forms(0).submit()
VB identifies this as a syntax error
web.Document.Forms(0).submit = True
VB states that there is an invalid method or empty value
The total program logs into a website, fills out a series of forms, generates an excel spreadsheet and pulls the data back into excel. These submit buttons are the only thing stopping the program from running.
I'll post the final code after everything is working.
Thanks in advance for any help