I'm attempting to have Excel open a web site, populate some fields, submit, and download the resulting data in a file.
My code never gets very far, however, because it looks like Excel doesn't recognize "getelementsbytagname" as an existing operation. I assume this is the issue because it does not correct the case to GetElementsByTagName like it does for everything else.
My References in the editor include Microsoft Internet Controls and Microsoft HTML Object Library. Is there another one that I need to activate?
The code is just a modified version of something found online.
Private Sub IE_automation()
'Retrieve data from Enterprise Reporting with IE
Dim i As Long
Dim IE As Object
Dim objElement As Object
Dim objCollection As Object
'Create Internet Explorer Object
Set IE = CreateObject("InternetExplorer.Application")
'Comment out while troubleshooting
'IE.Visible = False
'Send the form data to URL as POST binary request
IE.Navigate "http://corpprddatawhs1/Reports/Pages/Report.aspx?ItemPath=%2fInventory%2fInventory+By+Branch"
'Set statusbar
Application.StatusBar = "Webhost data is loading. Please wait..."
'Wait while IE loading
Do While IE.busy
Application.Wait DateAdd("s", 1, Now)
Loop
'Find 2 input tags:
' 1. Text field
' <input type="text" class="null" name="ct132$ct104$1ct105$txtValue" size="30" value="" />
'
' 2. Button
' <input type="submit" value="View Report" />
Application.StatusBar = "Searching form submission. Please wait..."
Set objCollection = IE.document.getelementsbytagname("input")