Thread: [Solved] Adding to a macro
View Single Post
 
Old 03-06-2016, 04:37 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,359
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

Try:
Code:
Sub CopyTables()
Application.ScreenUpdating = False
Dim DocSrc As Document, DocTgt As Document, Tbl As Table, Rng As Range
Set DocSrc = ActiveDocument: Set DocTgt = Documents.Add
For Each Tbl In DocSrc.Tables
  Set Rng = DocTgt.Characters.Last
  With Rng
    .Collapse wdCollapseEnd
    .FormattedText = Tbl.Range.FormattedText
    .Tables(1).Style = "Table Grid"
    .Collapse wdCollapseEnd
    .InsertAfter vbCr
  End With
Next
Set DocSrc = Nothing: Set DocTgt = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote