运行时错误'1004'提取网页数据时由应用程序定义或对象定义的错误

时间:2019-06-04 14:49:24

标签: excel vba runtime

嗨,我正在尝试使用excel VBA从网站中提取数据

但是我在第With Sheets("WTD Inputs PPR").Range("A1").QueryTable行上遇到了错误

Sub WTDPPR()
    Set Rng = ActiveCell
    Application.ScreenUpdating = False

    Sheets("WTD Inputs PPR").Visible = True
    Sheets("WTD Inputs PPR").Select
    Columns("A:AA").Select
    Selection.ClearContents
    With Sheets("WTD Inputs PPR").Range("A1").QueryTable
     .Connection = "URL;" + Range("LinkWTDPPR").Value
     .Refresh BackgroundQuery:=False
     Sheets("WTD Inputs PPR").Select
     Columns("A:A").Select
     Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
     Semicolon:=False, Comma:=True, Space:=False, other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
     Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15, 1), Array(16, 1), Array(17, 1)), TrailingMinusNumbers:=True

     Application.ScreenUpdating = False
     Sheets("WTD Inputs PPR").Visible = False

    End With
    Application.ScreenUpdating = False

End Sub

由于我是VBA的新手,您能帮我确定问题出在哪里以及我可以解决的任何方法吗?

0 个答案:

没有答案