+ Reply to Thread
Results 1 to 13 of 13

Get double pages when trying to Copy Web page to a worksheet

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    Albuquerque, New Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Get double pages when trying to Copy Web page to a worksheet

    Please help! I have a workbook that has a sheet with a list names and an associated hyperlink. I am wanting to design a macro to select each name, open the web page, select and copy the page and paste it into a new sheet. Here is the code that I have so far. It works for 1 or 2 names but then fails because it pulls up the same page twice.
    Any help would be appreciated!

    Please Login or Register  to view this content.
    Last edited by rfaris; 09-18-2013 at 06:15 PM. Reason: Wrong Title as per rules

  2. #2
    Registered User
    Join Date
    08-17-2012
    Location
    Albuquerque, New Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Get double pages when trying to Copy Web page to a worksheet

    Sorry about breaking the rules. I will be more carful in the future. Do I need to start another thread or does the current one look OK. Thanks

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Get double pages when trying to Copy Web page to a worksheet

    Hello rfaris,

    Try out this version of your macro.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    08-17-2012
    Location
    Albuquerque, New Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Get double pages when trying to Copy Web page to a worksheet

    Hello Leith Ross,
    Thanks for responding. I tried your code but I only get fragmented text from the web page. I was hoping for the whole page in HTML format.
    Rfaris

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Get double pages when trying to Copy Web page to a worksheet

    Hello rfaris,

    Sorry, I misunderstood what you wanted. Do you want to copy the web page HTML code to a worksheet then?

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Get double pages when trying to Copy Web page to a worksheet

    Hello rfaris,

    Sorry, I misunderstood what you wanted. Do you want to copy the web page HTML code to a worksheet then?

  7. #7
    Registered User
    Join Date
    08-17-2012
    Location
    Albuquerque, New Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Get double pages when trying to Copy Web page to a worksheet

    Hello Keith Ross,
    Yes, I am wanting the sheet to display the web exactly like it appears. I apologize for not being more clear with my request.
    Thanks,
    rfaris

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Get double pages when trying to Copy Web page to a worksheet

    Hello Rfaris,

    Do you have a sample of what the output should look like and/or a site I could visit?

  9. #9
    Registered User
    Join Date
    08-17-2012
    Location
    Albuquerque, New Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Get double pages when trying to Copy Web page to a worksheet

    Hello Leith Ross,
    Attached is a sample of what I am trying to achieve. Shown are the last four names on the list. I hope this helps.
    Thank You,
    rfaris
    Attached Files Attached Files

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Get double pages when trying to Copy Web page to a worksheet

    Hello Hello Rfaris,

    Thanks for posting that. Again, my mental view of the page layout was different. Now I can create a macro to do want you expect.

  11. #11
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Get double pages when trying to Copy Web page to a worksheet

    Hello Hello Rfaris,

    Sorry for the delay. I wanted to be sure the macro would fit with your needs. This is what I have done. The macro now takes a single argument when called. The argument is a cell with a link to the player. The macro opens Internet Explorer, minimizes it, selects all the data, copies it to clipboard, and pastes it to the new sheet. The new sheet name is taken from the cell. Only numbers and periods are used in the name. The macro checks if the sheet exists. If it does then you are asked if you want to replace it. when macro finishes, it closes Internet Explorer.

    Here is working code. This should be copied and pasted into a separate VBA module in the workbook. Be sure you call the macro from Excel instead of the VB Editor becuase you may receive a prompt about the worksheet. If you are in the VB Editor then the prompt will display and the macro will appear to be hung.
    Please Login or Register  to view this content.
    Test Macro
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    08-17-2012
    Location
    Albuquerque, New Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Get double pages when trying to Copy Web page to a worksheet

    Hello Leith Ross,
    Wow!! what a well designed Macro. This is better than I was looking for. Thanks very much

    Sincerly,
    rfaris

  13. #13
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Get double pages when trying to Copy Web page to a worksheet

    Hello rfaris ,

    You're welcome.

+ 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. VBA:How to Copy Slides on Web Page To Excel Worksheet
    By JohnM3 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-31-2012, 11:43 AM
  2. Copy 1 worksheet page from Workbook to Word using VBA
    By jennsuprgrl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2008, 12:09 PM
  3. [SOLVED] copy page setup from worksheet to another within workbook
    By Fanny in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-05-2005, 10:05 PM
  4. [SOLVED] Copy Worksheet to Preserve Page Set Up
    By TiChNi in forum Excel General
    Replies: 3
    Last Post: 04-26-2005, 03:06 PM
  5. [SOLVED] How do I copy page set up attributes from one worksheet to anothe.
    By KathieMacFarlane in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-26-2005, 07:06 PM

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