+ Reply to Thread
Results 1 to 2 of 2

Copying and Pasting Cells to Word (size is changing, screenshot included)

Hybrid View

  1. #1
    Registered User
    Join Date
    03-04-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2014
    Posts
    7

    Copying and Pasting Cells to Word (size is changing, screenshot included)

    Hello,

    I used the macro recorder to figure out how to copy and paste a certain cell range from excel into word. If I do it manually it looks very neat and close packed as if it was actually in excel. When I use my macro it now double spaces everything and the table is huge (taking up a full page...)


    This is part of a huge macro which auto-generates documents so I will just show you the necessary part.

    SUB TEST()
    Dim objword
    Dim objDoc
    Dim objSelection
    Set objword = GetObject(, "Word.Application")
    Set objDoc = objword.ActiveDocument
    objword.Visible = True
    Set objSelection = objword.Selection
    
     Range("P34:T63").Select
    Selection.Copy
    objSelection.Paste
    
    End Sub

    Here is a picture which shows the difference http://i.imgur.com/H8UJGV9.png

    Please help, thanks!

  2. #2
    Registered User
    Join Date
    03-04-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2014
    Posts
    7

    Re: Copying and Pasting Cells to Word (size is changing, screenshot included)

    Nevermind....

    Used the recorder and instead of just copying and pasting regularly (via CTRL+V) I went through the home button and clicked keep source formatting. so the important part of my code looks like this.

    Range("P34:T63").Select
    Selection.Copy
    objSelection.PasteExcelTable True, False, False
    objSelection.TypeParagraph
    objSelection.TypeParagraph
    Last edited by Smootheh; 03-11-2015 at 01:21 PM.

+ 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. [SOLVED] Copying and pasting data tables with changing row counts
    By arleutwyler in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2013, 11:14 AM
  2. Replies: 7
    Last Post: 02-03-2013, 10:01 AM
  3. Copying from Word and pasting into Excel
    By Magentasky in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 01-29-2010, 06:02 PM
  4. Replies: 1
    Last Post: 02-19-2006, 11:40 AM
  5. [SOLVED] copying from word and pasting into excel
    By nims in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-24-2005, 03:24 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