Innertext vba优化

时间:2017-09-22 17:05:18

标签: excel vba

我一直在使用以下vba来提取数据,大多数日子都可以。但是,我今天刚遇到错误。任何人都可以帮助指出我正确的方向来改善vba吗?感谢

Sub ExtractCP()
Dim ie As Object
Sheets("Sheet2").Range("A2:AZ3000").Clear


Set ie = CreateObject("InternetExplorer.Application")

With ie
    .Visible = False
    .Navigate "http://www.yahoo.com/"
    Do Until .ReadyState = 4: DoEvents: Loop



        x = .Document.body.innertext




        x = Split(x, Chr(13))
        Application.Wait (Now + TimeValue("00:00:03"))



        Sheet2.Cells(1, 1).Resize(UBound(x)) = Application.Transpose(x)

        .Quit
    End With

End Sub

0 个答案:

没有答案