Closed Thread
Results 1 to 5 of 5

Can't record a macro pasting and editing into a word doc

  1. #1
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Can't record a macro pasting and editing into a word doc

    I have tried recording a macro that would copy and paste a section of cells into a word document. The problem I run into is when I run the macro it follows all steps that took place in excel, yet it never does anything with the word document. When I read the macro code no reference is made to the word document. Here is what I am trying to do in step by step.

    In Excel
    Select U1:X1
    Shift control down arrow
    right click, copy

    In Word
    key shortcut to end of document
    Paste, use destination style
    Type "first word"

    In Excel
    right click, Copy R1

    In Word
    Paste, merge formatting, this is done to the right of "first word"
    Type "second word"

    In Excel
    Right click, Copy R2

    In Word
    Paste, merge formatting, this is done to the right of "second word"

    Any advice?

  2. #2
    Forum Contributor
    Join Date
    04-25-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    150

    Re: Can't record a macro pasting and editing into a word doc

    I made a small change, instead of merging in word, I've merged the cell values in excel and then copied and pasted the whole thing once rather than three separate actions. Try this:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Can't record a macro pasting and editing into a word doc

    Please Login or Register  to view this content.
    I am getting a runtime error 9: subscript out of range from this line

    Please Login or Register  to view this content.
    Unfortunately understanding code is a bit over my head at this point. My Excel file I am trying to do this with is called Training Stats while the specific sheet I am trying to run it off of is called Calculator. I tried changing around the names and it didn't fix the problem.
    Last edited by Butcher1; 10-22-2013 at 09:53 AM.

  4. #4
    Forum Contributor
    Join Date
    04-25-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    150

    Re: Can't record a macro pasting and editing into a word doc

    The name has to be the file name. ie:
    Please Login or Register  to view this content.
    paste both lines in instead of your
    Please Login or Register  to view this content.
    line

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Can't record a macro pasting and editing into a word doc

    Thread posted in the CS forum hence closed.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro for copying from excel and pasting into word file
    By kitcargray in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-24-2012, 06:03 PM
  2. Copy pasting folder macro - Editing needed
    By Raju Radhakrishnan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-02-2012, 07:52 PM
  3. [SOLVED] Pasting multiple ranges as Bitmaps into Word + Editing them
    By jmfenn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2012, 04:31 PM
  4. Record type of cell editing
    By patact in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-25-2009, 11:23 AM
  5. [SOLVED] Pasting text from Excel to Word (macro)
    By TT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-24-2005, 10:07 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