Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

webquery into worksheets? 1

Status
Not open for further replies.


Hi,

Data > Import External Data > New Web Query...

get it down for ONE.

Turn on your macro recorder and EDIT the query. Return data to Excel

Trun off your recorder and post back your recorded code.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Sub Macro4()

With Selection.QueryTable
.Connection = _
"URL; .WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingAll
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub


Skip, thanks for the quick reply...
 
Might be something like this. Should have recorded the QueryTable ADD...
Code:
    For i = 1 To 500
        With ThisWorkbook.Worksheets.Add
            With ActiveSheet.QueryTables.Add( _
                Connection:= _
        "URL;[URL unfurl="true"]http://www.mysite.com/Default.aspx?app=1&page=Network%20addn&compid="[/URL] & i, _
                Destination:=ActiveSheet.[A1])
                .Name = "WebQuery" & Format(i, "000")
                .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 With
        End With
    Next

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top