2016-08-16 100 views
0

我已經查看了其他幾個類似的問題,但我無法獲得任何解決方案來爲此頁面工作。我正在嘗試編寫VB代碼以更改年份下拉列表,填寫地址字段,然後單擊搜索。到目前爲止,我可以填寫這些信息,但我無法弄清楚如何點擊「搜索」按鈕。當我嘗試從其他人發佈的其他問題的解決方案中收到錯誤,例如「來自hresult 0x800A01B6的異常」。我是新來的,所以任何幫助,非常感謝。如何使用VB單擊網頁上的按鈕

鏈接:https://geomap.ffiec.gov/FFIECGeocMap/GeocodeMap1.aspx

當前代碼:

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 

回答

0

我想這是所有你需要查看的頁面後添加。您可以使用元素的click方法。

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 
相關問題