+ Reply to Thread
Results 1 to 3 of 3

"Paste method of worksheet class failed." Copying from webpage

  1. #1
    Registered User
    Join Date
    06-26-2013
    Location
    Spokane
    MS-Off Ver
    Excel 2007
    Posts
    15

    "Paste method of worksheet class failed." Copying from webpage

    Excel 2007

    I know this error has been solved many times before, but I have only seen workarounds, and my script requires an actual solution.

    I am running a VBA script in excel that copies (10-600) lines of information from a webpage and then pastes that into excel. The pulled information contains headers and tables, and excel nicely keeps their format when I paste.

    The paste works fine except for a random "runtime error 1004 paste method of worksheet class failed." As other posters have noted, the error goes away if you just hit 'Debug' and press play again. I could live with that myself, but this script will be used by others.

    The solutions on forums say to assign the cells the string instead of copy-paste into it. That's a great solution for them, but doesn't work for me because I need to keep the formatting from an external source (webpage). So the following does not work, it just puts everything into one column:

    Please Login or Register  to view this content.

    So here's my code:
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: "Paste method of worksheet class failed." Copying from webpage

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    06-26-2013
    Location
    Spokane
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: "Paste method of worksheet class failed." Copying from webpage

    That works, thank you!

    Seems odd to me that Cells(1,1).Paste works over Cells(1,1).Select, ActiveCell.Paste
    Last edited by bubleeshaark; 06-26-2013 at 01:27 PM.

+ 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