#1
|
|||
|
|||
How to adjust line spacing of a table pasted into Word from Excel
Hi all, I was hoping someone could help me with formatting of a table that I just pasted into a word doc from excel, specifically the line spacing given excel cells don't offer spacing the text at 1.5x or 2x like word does. Without posting all the code, I have this simple section which selects the table in Excel and pastes it into Word based on the bookmark set. I then would like to somehow select that table after said pasting and change the line spacing of the text:
wsRepCom.Activate wsRepCom.Range("Table3").Copy wd.Bookmarks("Table3").Range.PasteExcelTable False, False, True The above successfully pastes the table, just not sure how to then adjust the line spacing. Any help is much appreciated!! |
#2
|
||||
|
||||
I assume you are running the macro in Excel, in which case
Code:
Dim wd As Object Dim oRng As Object Dim oTable As Object Dim wsRepCom As Worksheet Set wsRepCom = ActiveSheet On Error Resume Next Set wd = GetObject(, "Word.Application") On Error GoTo 0 wsRepCom.Range("Table3").Copy Set oRng = wd.activedocument.Bookmarks("Table3").Range oRng.PasteExcelTable False, False, True Set oTable = oRng.Tables(1) With oTable .AutoFitBehavior 1 .Range.ParagraphFormat.SpaceAfter = 6 End With
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
||||
|
||||
Cross-posted at: How to adjust line spacing of a table pasted into Word from Excel
For cross-posting etiquette, please read: Excelguru Help Site - A message to forum cross posters
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Publisher 2010 refuses to hold change in Normal from 0.94 line spacing to 1 line spacing | mkcsufi | Publisher | 0 | 11-28-2019 07:05 AM |
Returns in Word table text become multiple rows when pasted in Excel | blorence | Word Tables | 8 | 01-23-2019 01:57 PM |
How do I adjust above spacing in table? | Silverlining | Word | 1 | 07-02-2016 10:10 AM |
a table pasted in word from excel is not similar to the original table in excel | Mukapa | Word Tables | 1 | 01-18-2016 07:31 AM |
Cannot Adjust Line Spacing of Text at Top of Page | Jgreer0315 | Word | 6 | 02-10-2014 01:26 PM |