Results 1 to 1 of 1

Automatic Web query from multiple links in cells

Threaded View

  1. #1
    Registered User
    Join Date
    08-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    1

    Automatic Web query from multiple links in cells

    Greetings to all,

    I am new to the forum and are interested in learning about VBA/Macros.

    Here I have a small problems about automatic web query. Hope the teachers here can help. Great Thanks.

    Question: How do I automatic the web query process for all the links in my workbook.

    In my workbook(attached), I have the worksheet"URL".
    In worksheet "URL", cell A1 to A574 contains link that I capture from a website.
    The links all have similar format of http://www.reb.......company=51. The number "51" is a unique id for a company.
    A change of that number will lead to different company's roster.
    The URLs will open up pages with very similar structure, each page contains one table of member roster.
    I need to capture that the roster table from each of the links and paste them onto a new worksheet. (sheet8 in my workbook is a example result)

    I only know how to do one web query at a time and don't have enough knowledge to modify the code correctly.

    I had recorded my macro for one links, and below are the codes.

    Sub Scrape()
    '
    ' Scrape Macro
    '
    ' Keyboard Shortcut: Ctrl+s
    '
        Range("A2").Select
        ActiveWorkbook.Worksheets.Add
        With ActiveSheet.QueryTables.Add(Connection:= _
            "URL;http://www.rebny.com/RLS_company_results.jsp?company=51", Destination:= _
            Range("$A$1"))
            .Name = "RLS_company_results.jsp?company=51_2"
            .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 = "9"
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = True
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = False
            .Refresh BackgroundQuery:=False
        End With
    End Sub
    Attached Files Attached Files
    Last edited by yukisome; 08-17-2013 at 04:28 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Forcing Automatic Links - Multiple Workbooks
    By lee1601 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-13-2011, 05:05 PM
  2. Forcing Automatic Links - Multiple Workbooks
    By lee1601 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2011, 05:04 PM
  3. Forcing Automatic Links - Multiple Workbooks
    By lee1601 in forum Excel General
    Replies: 0
    Last Post: 09-13-2011, 05:02 PM
  4. Automatic grab stats from web query cells
    By Bøtteknott in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2011, 11:16 AM
  5. [SOLVED] Maintaining links to cells for database query ranges
    By Chris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2005, 11:06 AM

Tags for this Thread

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