View Single Post
 
Old 08-18-2019, 08:44 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,431
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Well you aren't actually saving the table as a range. The table already defines a range.


A character defines a range, a word defines a range, a paragraph defines a range and yes, a table does too. ;-)


Here is an abbreviated version that does the same thing with no declared range variables.

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oDoc1 As Document
Dim oDoc2 As Document
  Set oDoc1 = ActiveDocument
  Set oDoc2 = Documents.Add 'Some other document
  oDoc1.Activate
  oDoc2.Range.FormattedText = oDoc1.Tables(1).Range.FormattedText
  oDoc2.Activate
lbl_Exit:
  Exit Sub
  
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote