![]() |
#1
|
|||
|
|||
![]()
Hello everyone,
I am attempting to learn VBA through videos and reading multiple post but can't seem to figure out how to go about doing my project. Please bear with me any growing pains as I'm trying to learn and understand the logic. I have multiple (4) templates with bookmarks created: (a) Contract number (b) Client Name (c) Effective date for each. Templates are stored in my local drive. I am attempting to create a userform to enter the data and select a specific template through a checkbox. So far I've learned to create the userform to populate the fields to one template when the user enter the data but can't figure out how to populate each template and pull the specific template needed when the user selects a specific checkbox. Please HELP! |
#2
|
||||
|
||||
![]()
There is a better way to do this - put mapped Content Controls in the document where you want that data to be displayed. You can then either read or write to the first instance of each CC in the document to interact with the vba userform.
There are quite elegant templates to help with content controls (created by Greg Maxey and Graham Mayor which can be very useful if you are struggling with some of the concepts. If you add a few content controls to your first template and set them to be mapped to built-in properties then you can paste these into the other templates at the relevant locations. You can then include code to read/write to the CCs OR to the document properties. eg Code:
Sub DocProps() Dim aCC As ContentControl For Each aCC In ActiveDocument.ContentControls aCC.Range.Text = aCC.Title If aCC.XMLMapping.IsMapped Then aCC.Tag = aCC.XMLMapping.XPath End If Next aCC End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Open a document based on a template, the page numbers in the TOC won't update | billy8b8 | Word | 2 | 10-04-2015 06:06 AM |
![]() |
snickerbart | Outlook | 4 | 04-17-2015 12:55 PM |
Create scope-specific plans from Master Template | BobbyG | Project | 3 | 04-08-2015 06:15 AM |
![]() |
AndyR | PowerPoint | 3 | 09-25-2014 06:05 PM |
Does Word have an option to update fields AUTOMATICALLY at open??? | Jamal NUMAN | Word | 17 | 01-27-2012 12:57 AM |