Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-18-2019, 07:58 AM
gmaxey gmaxey is offline Inserting a Table using VBA Windows 10 Inserting a Table using VBA 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 ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oDoc1 As Document
Dim oDoc2 As Document
Dim oRng As Range, oRngInsert As Range
  Set oDoc1 = ActiveDocument 'The one with the table
  Set oDoc2 = Documents.Add 'Some other document
  
  Set oRng = oDoc1.Tables(1).Range
  Set oRngInsert = oDoc2.Range
  oRngInsert.Collapse wdCollapseEnd
  oRngInsert.FormattedText = oRng.FormattedText
lbl_Exit:
  Exit Sub
  
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
syntax for inserting blank line before inserting table and after a line or paragraph SamDsouza Word VBA 8 08-04-2019 11:10 PM
Inserting graphic in last table lodi123 Word VBA 2 07-07-2017 06:48 AM
Inserting a Table using VBA Inserting a table using ADD command snufse Word VBA 1 11-10-2015 03:28 PM
Inserting a Table using VBA Inserting table natasha_arriell Mail Merge 4 06-04-2014 12:13 AM
Inserting a table Katelyn Outlook 0 04-05-2012 09:39 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:13 PM.


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