![]() |
|
|
|
#1
|
||||
|
||||
|
If you're wedded to having the data in Excel, you could use a macro like: Code:
Sub Demo()
Application.ScreenUpdating = False
Dim xlObj As Object, xlWkBkObj As Object
With Selection.Tables(1).Range
'Pre-format the table
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "[^13^l]"
.Replacement.Text = Chr(182)
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
'Copy the table
.Copy
End With
ActiveDocument.Undo
'Start Excel if not running
On Error Resume Next
Set xlObj = GetObject(, "Excel.Application")
' Start Excel if it isn't running
If xlObj Is Nothing Then Set xlObj = CreateObject("Excel.Application")
With xlObj
'Add a workbook
Set xlWkBkObj = .Workbooks.Add
With xlWkBkObj.Sheets(1)
'Paste the data
.Paste '.Range("A1")
'Post-format the data
With .UsedRange
.HorizontalAlignment = 1 'xlGeneral
.WrapText = False
.Columns.AutoFit
.Replace Chr(182), Chr(10)
.Columns.AutoFit
.Rows.AutoFit
End With
End With
.CutCopyMode = False
.Visible = True
End With
Application.ScreenUpdating = True
End Sub
For Mac macro installation & usage instructions, see: https://wordmvp.com/Mac/InstallMacro.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
| Tags |
| enter, filename as document text, insert column, paste, rows, vba in word |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 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 |
| Modify a just-pasted Excel table | p45cal | Word VBA | 2 | 09-26-2015 01:02 PM |
| Excel Multiple Rows Merged into Word (Vertical Format) | ats1025 | Mail Merge | 3 | 11-19-2013 02:21 PM |
Add multiple rows to Excel 2010 table at cursor position
|
C J Squibb | Excel Programming | 12 | 11-07-2013 07:35 AM |
| connectors between cells in pasted Excel table | eNGiNe | Word | 7 | 10-16-2013 11:58 PM |