+ Reply to Thread
Results 1 to 7 of 7

Macro to copy cell contents (a website) -> paste in exctract external data url address box

  1. #1
    Registered User
    Join Date
    07-23-2014
    Location
    Laguna Beach, California
    MS-Off Ver
    2010
    Posts
    8

    Macro to copy cell contents (a website) -> paste in exctract external data url address box

    Im trying to use a macro to copy a website in a cell and then open "get external data from web", paste it in the url box, and then import the data.

    It works while I'm recording it but when I change the website, it copies and pastes the old one instead. What am I doing wrong?

    Thanks!!

    Heres the Macro Code

    Range("G26").Select ***Its here where even when G26 changes it doesnt change in the clipboard***
    ActiveWorkbook.Worksheets.Add
    With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;https://www.linkedin.com/company/facebook", Destination:=Range("$A$1"))
    .Name = "facebook"
    .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

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Macro to copy cell contents (a website) -> paste in exctract external data url address

    I pieced this together for a marketing firm earlier this year. I'm sure the code could be salvaged for your use.

    (This code ran through a series of cells with URLs and pasted each destination as a web query to a new tab.)


    Please Login or Register  to view this content.

    I'd imagine you'd want to include in your code specifically to clear the contents of A1, at the beginning of each run. A1 holds the web query details and running it again won't overwrite the existing web connection.
    Attached Files Attached Files
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    07-23-2014
    Location
    Laguna Beach, California
    MS-Off Ver
    2010
    Posts
    8

    Re: Macro to copy cell contents (a website) -> paste in exctract external data url address

    daffodil11 thanks for that, the one thing I can't figure out though is how to identify the webtables on the linkedin website. Any suggestions?

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Macro to copy cell contents (a website) -> paste in exctract external data url address


    Do it manually using Macro recorder for example …

  5. #5
    Registered User
    Join Date
    07-23-2014
    Location
    Laguna Beach, California
    MS-Off Ver
    2010
    Posts
    8

    Re: Macro to copy cell contents (a website) -> paste in exctract external data url address

    Marc L: "It works while I'm recording ..." I did use the macro recorder. Any suggestions on how to get it to record the part where I copy the cell?

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Macro to copy cell contents (a website) -> paste in exctract external data url address


    Use Macro recorder for each website and see what arguments change …

  7. #7
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Macro to copy cell contents (a website) -> paste in exctract external data url address

    I ran it a number of times. I only ever came up with a single table every time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Automating data exctract from a data website.
    By andrewintuit in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-01-2014, 03:10 PM
  2. Replies: 3
    Last Post: 05-30-2014, 01:15 PM
  3. Excel Macro to copy paste ecel data to website
    By muthu_1289 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-23-2013, 11:32 AM
  4. Macro to Copy data from e-mail and paste it into a field on a website
    By joebobcletusjr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-16-2005, 01:19 PM
  5. Replies: 0
    Last Post: 02-14-2005, 02:09 PM

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