0

亲爱的贡献者,

我想自动从网站下载内容并将其放置到 Excel 中。

我已经创建了一个带有提示框的代码来从网络中提取内容。

我现在想做的事,经过多次尝试都没有成功,就是只选择网页内容的第二行。最重要的是,我想在每次刷新查询时替换 excel 中的内容。

请参阅下面我当前的代码以获取信息。提前感谢任何建议。

Sub URL()
'
' URL Macro
'
Dim dt_begin As String
Dim olivier As String

dt_begin = InputBox("Give begin date", "date", "1")
olivier = dt_begin

    Range("E2").Select
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;https://wuki.vw.vwg/jctwukip/WuKI/k-dtk/jsp/zinstabellen/detailzinstabelle.jsp?CCYID=130&begin=" & dt_begin & "&ende=" & olivier & "&titel=A2-B2&lang=en" _
        , Destination:=Range("$G$1"))

        .Name = "31&titel=A2-B2&lang=en"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "2"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With

End Sub
4

0 回答 0