VBA website crawler error

kvitekvist

New member
Joined
May 10, 2013
Messages
1
Reaction score
0
Points
0
Hello everyone,

This is my furst post in this forum, as i am quite new to VBA. I have a problem right now with a code, and hope to have some help on how to solve it.

I am trying to make a very simple crawler (extracting information from a website automaticly). The website I want to crawl will always change, but the address to crawl will always be found in cell E1.

The code I have so far is this:

Code:
Sub test2()'
' test2 Macro
'


'
    Selection.Copy
    Range("E1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = Range("E1")
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL; & ActiveCell.Offset(0, -1).Value" _
        , Destination:=Range("$A$1"))
        .Name = "Test 1"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlEntirePage
        .WebFormatting = xlWebFormattingNone
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
End Sub

Any idea on how I can solve this?

Many thanks, and kind regards,
Jens
 
Back
Top