+ Reply to Thread
Results 1 to 4 of 4

Excel VBA: copy Excel and paste into Word as text

  1. #1
    Registered User
    Join Date
    08-12-2013
    Location
    USA
    MS-Off Ver
    Excel 2016, 32-bit
    Posts
    92

    Question Excel VBA: copy Excel and paste into Word as text

    I've been working on this for about a week and I'm thoroughly frustrated. I have tried this a bunch of ways, so I'm assuming there is something else wrong with the code. I'm also doing this without a reference to the MSWord Object Library, as I need this to work for any version of Office. Can someone take a look?

    I'm trying to copy a range from the current excel sheet (this part works great) and then open word and paste into a new document as text.

    The error I keep getting is a run time "error 424: Object needed." on the line that begins .Selection

    Please Login or Register  to view this content.
    Thanks!

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Excel VBA: copy Excel and paste into Word as text

    Right, I dont understand why this makes a difference as its not sensible but the following works.

    Please Login or Register  to view this content.
    If someone has helped you then please add to their Reputation

  3. #3
    Registered User
    Join Date
    08-12-2013
    Location
    USA
    MS-Off Ver
    Excel 2016, 32-bit
    Posts
    92

    Re: Excel VBA: copy Excel and paste into Word as text

    Quote Originally Posted by pjwhitfield View Post
    Right, I dont understand why this makes a difference as its not sensible but the following works.

    Please Login or Register  to view this content.
    Oddly, that does work but it doesn't paste as text, it's just a regular paste.

  4. #4
    Registered User
    Join Date
    08-12-2013
    Location
    USA
    MS-Off Ver
    Excel 2016, 32-bit
    Posts
    92

    Re: Excel VBA: copy Excel and paste into Word as text

    I think I figured it out

    I changed
    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    where 22 is the const for "wdFormatPlainText"

+ 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. Replies: 0
    Last Post: 09-04-2014, 03:32 AM
  2. Copy text in excel cells and paste as bullet into new word doc
    By olivierpbeland in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-03-2013, 05:09 PM
  3. [SOLVED] Copy table in excel and paste as text in word
    By himanshu83 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-24-2012, 10:50 AM
  4. Copy text from excel and paste in word - Urgent Help
    By sippy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2006, 04:51 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