Good afternoon,
I'm trying to set a means of automating some reporting for a in-house website. I teach at a college, and need to pull some data from faculty-accessible databases through the college-provided interface. So, I'm trying to access material I am authorized to see, will need to sign in to see, but don't want to repeat the steps potentially hundreds of times.
My thought is to:
1) log into the college-provided interface using IE with my credentials (so the system knows I'm authorized).
2) Provide excel with a list of ID numbers on the students I'm trying to track
3) use VBA to iterate through each ID, performing the following steps:
- Enter the ID number from the list in Excel into the appropriate form text box
- Click the "Submit" button
- Click a secondary "Submit" button on the resulting page
- Copy the resulting HTML text page that appears and parse it out for the information I need
- Move on to the next number and repeat
I've tried some of the other options I've seen (such as VBA to Enter Data Online and Submit Form) but am getting errors on the syntax.
The relevant portion of the HTML coding on the site I'm trying to reference is:
<FORM ACTION="action" METHOD="POST" NAME="idinputform">
Enter Number Here:
<INPUT TYPE="number" NAME="ID_NUM" SIZE="9" MAXLENGTH="9">
<INPUT TYPE="hidden" NAME="refresh_proc" VALUE="menu_1">
<INPUT TYPE="submit" VALUE="Submit"> <INPUT TYPE="reset" VALUE="Reset">
</FORM>
What I've got in Excel is:
Sub QueryInfo()
Application.ScreenUpdating = False
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "website address"
IE.Document.idinputform.number.Value = "000000000"
Application.ScreenUpdating = True
End Sub
So, I start by opening an IE window and logging into the interface, and then start the VBA. The application runs, opens a new IE window, hits the website (which retains my login authority from the first one), and then crashes with an unspecified error.
It seems like this should be straightforward, but I'm just not seeing it.
Thanks! -G-