GetElementByID从HTML到Excel失败

任何人都可以帮助我这个VBScript? 尝试使用getelementbyID将值从IE拉到Excel,但脚本仅将[对象HTMLDivElement]传输到Excel。

Set objExplorer = CreateObject("InternetExplorer.Application") WebSite = "https://www.google.co.uk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=abbott+stocks" Const READYSTATE_COMPLETE = 4 WScript.Sleep 1000 With objExplorer .Navigate2 WebSite .Left=5 .Top=5 .Height=1000 .Width=700 .AddressBar = 0 .Visible = 1 .ToolBar = 0 .StatusBar = 0 Do Until .ReadyState = READYSTATE_COMPLETE Loop End With Set xl = CreateObject("Excel.Application") xl.Visible = True Set wb = xl.Workbooks.Open("C:\Users\ukristense\Documents\CI\testauto.xlsx") Set ws = wb.Sheets("Sheet1") WScript.Sleep 5000 ws.Range("A1").Value = objExplorer.document.getElementById("resultStats") WScript.Sleep 5000 objExplorer.Quit 

您试图将对象设置为值,您将需要根据您的需要采取innerTextouterTextouterHTMLinnerHTML

 ws.Range("A1").Value = objExplorer.document.getElementById("resultStats").innerText