![]() |
#2
|
||||
|
||||
![]()
There are several ways that you could handle this. I suspect my preference would be to save the core document as a macro enabled template and all the tables as separate Autotext/Building Block entries in that template.
You could then create a simple userform with four radio buttons, the selection from which would insert the appropriate building block in the new document created from the template. I would start with the document template having an autotext field inserted to display one of the autotext entries. It is then a simple matter to replace the field code according to the choice of option button. The following macro will change the field. Call it from the userform e.g. Code:
Sub ChangeAutoText(strText As String) Dim oFld As Field Dim oRng As Word.Range Set oRng = ActiveDocument.Range For Each oFld In oRng.Fields If oFld.Type = wdFieldAutoText Then oFld.Locked = False oFld.Code.Text = Replace(oFld.Code, oFld.Code.Text, "AUTOTEXT " & strText) oFld.Update oFld.Locked = True Exit For End If Next oFld lbl_Exit: Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
RYSiebert | Word | 1 | 12-09-2013 11:03 AM |
Combining Tracked Changes in WORD | pghboy | Word | 0 | 12-13-2012 09:36 AM |
Combining Multiple Word Documents Heading/Figure Issues Word 2007 | grantgibson45 | Word | 1 | 09-10-2012 11:00 PM |
combining word documents with endnotes | mikelee114 | Word | 1 | 04-08-2012 05:27 AM |
![]() |
dms997 | Word | 5 | 02-26-2011 03:25 AM |