How can I use VB to click button on webpage

0

I've looked at several other similar questions but I haven't been able to get any of their solutions to work for this page. I'm trying to write VB code to change the year drop down, fill in the address field, and then click search. So far I'm able to fill in the information but I can't figure out how to click the 'Search' button. When I try solutions from several other questions posted by people I get errors like "exception from hresult 0x800A01B6". I'm new to this so any help is greatly appreciated.

Link: https://geomap.ffiec.gov/FFIECGeocMap/GeocodeMap1.aspx

Current code:

dim oIE

oIE = CreateObject("InternetExplorer.application")
oIE.Visible = True
oIE.Navigate("https://geomap.ffiec.gov/FFIECGeocMap/GeocodeMap1.aspx")

While oIE.Busy: End While

With oIE.Document
    .GetElementById("yearSelect").Value = "2015"
    .GetElementById("Address").Value = "Enter address here"
End With
html
vba
asked on Stack Overflow Aug 16, 2016 by Xeric

1 Answer

0

I think this is all you need to add after looking at the page. You can use the click method of the element.

dim oIE as Object ' Changed the type here, it will be an Object

oIE = CreateObject("InternetExplorer.application")
oIE.Visible = True
oIE.Navigate("https://geomap.ffiec.gov/FFIECGeocMap/GeocodeMap1.aspx")

While oIE.Busy: End While

With oIE.Document
    .GetElementById("yearSelect").Value = "2015"
    .GetElementById("Address").Value = "Enter address here"
    .GetElementById("btnSearch").Click
End With
answered on Stack Overflow Aug 16, 2016 by Ryan Wildry

User contributions licensed under CC BY-SA 3.0