Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-03-2020, 07:21 AM
rkeck05 rkeck05 is offline How to adjust line spacing of a table pasted into Word from Excel Windows 10 How to adjust line spacing of a table pasted into Word from Excel Office 2019
Novice
How to adjust line spacing of a table pasted into Word from Excel
 
Join Date: Jan 2020
Posts: 1
rkeck05 is on a distinguished road
Question 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!!
Reply With Quote
  #2  
Old 01-03-2020, 10:12 PM
gmayor's Avatar
gmayor gmayor is offline How to adjust line spacing of a table pasted into Word from Excel Windows 10 How to adjust line spacing of a table pasted into Word from Excel Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #3  
Old 01-03-2020, 10:17 PM
macropod's Avatar
macropod macropod is offline How to adjust line spacing of a table pasted into Word from Excel Windows 7 64bit How to adjust line spacing of a table pasted into Word from Excel Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

Thread Tools
Display Modes


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
How to adjust line spacing of a table pasted into Word from Excel 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
How to adjust line spacing of a table pasted into Word from Excel Cannot Adjust Line Spacing of Text at Top of Page Jgreer0315 Word 6 02-10-2014 01:26 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:25 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft