[英]How do I make macro pull data from different sheets within a workbook. Excel VBA
[英]pull data to workbook in excel
尝试从网站抓取数据时出现问题。 它是运行时错误'424':所需对象我的代码:
Option Explicit
Sub GetData()
Dim IE As New SHDocVw.InternetExplorer
IE.Visible = True
IE.Navigate "abc.com"
Do While IE.ReadyState <> READYSTATE_COMPLETE
Loop
IE.Document.forms("vinSearchForm").elements("vin").Value =
"******"
IE.Document.forms("vinSearchForm").elements("vinSearch").Click
Sheets("Sheet1").Select
Range("A10").Select
IE.Document.forms("vinSummaryForm").elements
("test_vinSummary_carSpecification_$4").Value = Range("A10").Value
End Sub
我想要的是在Range(“ A10”)中显示结果“ 2004 *********”。 请相应地帮助我。 谢谢。
虽然不是最好的方法,但是应该为您工作
Option Explicit
Sub Autocheck()
Dim IE As New SHDocVw.InternetExplorer
IE.Visible = True
IE.Navigate "Autocheck.com"
Do While IE.ReadyState <> READYSTATE_COMPLETE Or IE.Busy
DoEvents
Loop
Application.Wait Now + TimeSerial(0, 0, 5)
IE.Document.forms("vinSearchForm").elements("vin").Value = "JTDKB22U140021007"
IE.Document.forms("vinSearchForm").elements("vinSearch").Click
Do While IE.ReadyState <> READYSTATE_COMPLETE Or IE.Busy
DoEvents
Loop
Application.Wait Now + TimeSerial(0, 0, 5)
Range("A10").Value = Split(IE.Document.getelementbyid("test_vinSummary_carSpecification_$4").innerText, vbNewLine)(1)
IE.Quit
Set IE = Nothing
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.