Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-17-2014, 11:01 PM
gmayor's Avatar
gmayor gmayor is offline Help on combining 4 word docs in 1 Windows 7 64bit Help on combining 4 word docs in 1 Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help on combining 4 word docs in 1 combining borders and word art 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
Help on combining 4 word docs in 1 Combining Word Documents dms997 Word 5 02-26-2011 03:25 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:04 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