#1
|
|||
|
|||
Word VBA replicate Insert > Quick parts > Document properties > Title
Hi, y'all!
I'm seeking help in replicating in VBA – and at the same time automating – the following procedure: Quick parts > Document properties > Title. I'm using it to repeat some data – mainly text and number – in various parts of the document, but I want it to behave like so: when you modify an inserted field in one place, all fields are changed, no matter what field was modified. I hope it is possible. Thanks in advance. |
#2
|
||||
|
||||
Yeap, it is a pain when the macro recorder doesn't give us anything.
This is working for me Code:
Sub Macro1() Dim aCC As ContentControl, xPart As CustomXMLPart Set aCC = ActiveDocument.ContentControls.Add(wdContentControlText) aCC.Title = "Title" Set xPart = ActiveDocument.CustomXMLParts.SelectByNamespace("http://schemas.openxmlformats.org/package/2006/metadata/core-properties")(1) aCC.XMLMapping.SetMapping XPath:="/ns1:coreProperties[1]/ns0:title[1]", Source:=xPart End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Insert\Quick Parts\Field How to combine | chester1525 | Word | 3 | 10-11-2019 09:06 AM |
Macro to save Word 2007 document using info from Quick Parts | staicumihai | Word VBA | 2 | 08-08-2018 01:21 AM |
Set Default Filename: Title Composed of Two Document Properties | mike_302 | Word VBA | 1 | 01-18-2018 04:36 AM |
Keep Quick Parts with current document | Cosmo | Word | 3 | 01-06-2015 08:57 PM |
Moving Quick Parts with the document | derohanes | Word | 4 | 10-23-2013 09:30 PM |