View Single Post
 
Old 10-30-2020, 08:17 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub CopyTables()
Dim oDoc As Document
Dim oDocTarget As Document
Dim oTbl As Table, oTblTarget As Table
Dim oRng As Range
  Set oDoc = ActiveDocument
  Set oDocTarget = Documents.Add
  For Each oTbl In oDoc.Tables
     Set oRng = oDocTarget.Range
     With oRng
       .Collapse wdCollapseEnd
       oRng.FormattedText = oTbl.Range.FormattedText
       Set oTblT = oRng.Tables(1)
       oTblT.Style = "Table Grid"
       .Collapse wdCollapseEnd
       .Text = vbCrLf
      End With
    Next
  oDocTarget.Range.Select
  Selection.ClearFormatting
  Selection.Collapse wdCollapseStart
  oDoc.Activate
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote