vendredi 24 avril 2015

Web Tables import using VBA - the macro should ignore first and last two table from the link

weblink = "URL;http://ift.tt/1GeP9UV" & sheetname & ".html" MsgBox ("Kindly check the weblink for the date you want the check = " & weblink) ActiveSheet.Select On Error Resume Next ActiveSheet.Name = sheetname

With ActiveSheet.QueryTables.Add(Connection:=weblink, Destination:=Range("A1"))
    .Name = "query14858_target5271_2015" & sheetname
    .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,3,4,5,6,7,8,9,10,11,12,13,14,15"
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
End With




Aucun commentaire:

Enregistrer un commentaire