+ Reply to Thread
Results 1 to 2 of 2

help with a macro (web queries)

  1. #1
    Registered User
    Join Date
    01-27-2005
    Posts
    31

    Arrow help with a macro (web queries)

    hi all,

    I am trying to create a macro that will import data from a web page as specified on the worksheet (so that I can change where it imports data each time), but at the moment I can only get it to look up one specific web page.

    Here's what I've got so far:

    Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 03/03/2005 by SwapitShop
    '
    ' Keyboard Shortcut: Ctrl+w
    '
    Range("Q3").Select
    Selection.Copy
    Range("Q5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
    "http://www.swapitshop.com/cgi-bin/swapitshop/browse.cgi?detailed_view=1&swap_id=565591&full_details=565591&action=view"
    Range("Q6").Select
    With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;http://www.swapitshop.com/cgi-bin/swapitshop/browse.cgi?detailed_view=1&swap_id=565591&full_details=565591&action=view" _
    , Destination:=Range("C8"))
    .Name = _
    "browse.cgi?detailed_view=1&swap_id=565591&full_details=565591&action=view"
    .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 = "17,21"
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
    End With
    ActiveWindow.SmallScroll Down:=-9
    End Sub
    Sub Macro2()
    '
    ' Macro2 Macro
    ' Macro recorded 03/03/2005 by SwapitShop
    '
    ' Keyboard Shortcut: Ctrl+t
    '
    Range("C8:E250").Select
    Selection.ClearContents
    ActiveWindow.SmallScroll Down:=-12
    Range("C8").Select
    End Sub


    Please note all the web pages I am trying to query have exactly the same layout just different content.

    thanks for your help
    Leon

  2. #2
    Registered User
    Join Date
    01-27-2005
    Posts
    31
    If any excel wizz-kids out there can help I would be very thankful

+ 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