我想通过输入特定日期和提交数据,使用excel vba提取表格网站。我想要那个日期的表

时间:2015-01-24 05:02:31

标签: excel-vba web-scraping vba excel

'我试过这个,这里面不包含提取表的代码。 我需要使用vba宏做这4件事。

1.enter the website 
2.enter the date 
3.Search the price form the website 
4.Return the table to the excel worksheet form the website 

Sub ClickButton()
Dim ie As Object
Dim form As Variant, button As Variant
Dim MyHTML_Element As IHTMLElement


Set ie = CreateObject("InternetExplorer.Application")
dateinput = InputBox("Enter date of for searching table eg. 2015-01-19")
With ie
.Visible = True
.navigate ("http://www.sharesansar.com/today.php#")

While ie.ReadyState <> 4
DoEvents
Wend
ie.document.getElementsbyname("date").Item.innertext = dateinput

Set form = ie.document.getElementsByTagName("form")
Set Buttoon = form(0).onsubmit
form(0).submit

End With
Set ie = Nothing

End Sub

1 个答案:

答案 0 :(得分:0)

错字:

Set Button = form(0).onsubmit

应该是一个按钮。