0

Dears contributors,

I would like to automatically download content from a website and place it to excel.

I have already created a code with a prompt box to extract the content from the web.

What i would like to do now, without success after many tries, is to select only the second row of the web content. On top, i would like to replace the content in the excel each time i refresh my query.

Please see below my current code for information. Many thx in advance for any advice.

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
QHarr
  • 83,427
  • 12
  • 54
  • 101
  • This looks like a *"here is my code please fix it"* question. Please read: [ask] and [Why is “Can someone help me?” not an actual question?](https://meta.stackoverflow.com/a/284237/3219613) – Pᴇʜ Dec 14 '18 at 09:47
  • Hi, sorry i just tried to go straight to the point.. i tried to do this myself for many hours but i have no background in VBA and i just would like to learn. I was hoping someone could help me complete my code. – Oliviertwist Dec 14 '18 at 09:58
  • No worries, you can still [edit] your question and improve it. Otherwise there is a high probability of getting down-votes or close-votes of the community. – Pᴇʜ Dec 14 '18 at 10:00
  • ok i will do so. thx – Oliviertwist Dec 14 '18 at 10:00
  • could you please provide an example full url we can test with. – QHarr Dec 18 '18 at 01:01

0 Answers0