+ Reply to Thread
Results 1 to 2 of 2

Copy web query across sheets

  1. #1
    Registered User
    Join Date
    07-10-2004
    Posts
    37

    Copy web query across sheets

    Hi,

    I have a web query which I want to copy across all sheets in a workbook. How do I do this?

    Thanks,

    Bertie

  2. #2
    BBert
    Guest

    Re: Copy web query across sheets

    On Sun, 26 Jun 2005 11:29:15 -0500, claytorm wrote...

    > I have a web query which I want to copy across all sheets in a
    > workbook. How do I do this?


    As far as I know, the copy method doesn't apply to Querytables. Just use
    a For Each Loop to cycle through your WorkSheets and place the same
    Query on every Sheet.
    Example:
    ********
    Sub Same_Query_On_Every_Worksheet()
    Dim Sh As Worksheet
    Dim strLetter As String
    strLetter = "A"
    For Each Sh In ThisWorkbook.Worksheets
    'Build Connectstring
    strConnectString = "URL;http://xbox360.ign.com/index/games.html?
    constraint.grid.sort=game+title&constraint.grid.sortorder=asc&constraint
    ..grid.letter=" & strLetter
    Set QT = Sh.QueryTables.Add(Connection:=strConnectString, _
    Destination:=Sh.Range("B1"))

    With QT
    .Name = strName
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = False
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .WebSelectionType = xlSpecifiedTables
    .WebFormatting = xlWebFormattingAll
    .WebTables = "2"
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
    End With
    Next
    End Sub

    ********
    --
    Met vriendelijke groeten / Mit freundlichen Grüßen / With kind
    regards/Avec mes meilleures salutations
    BBert

    April 20, 1986
    Celtics (135) - Bulls (131)
    Larry Bird: "God disguised as Michael Jordan"

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1