Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-18-2022, 05:11 AM
Guessed's Avatar
Guessed Guessed is offline Word VBA replicate Insert > Quick parts > Document properties > Title Windows 10 Word VBA replicate Insert > Quick parts > Document properties > Title Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,995
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word VBA replicate Insert > Quick parts > Document properties > Title Insert\Quick Parts\Field How to combine chester1525 Word 3 10-11-2019 09:06 AM
Word VBA replicate Insert > Quick parts > Document properties > Title 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
Word VBA replicate Insert > Quick parts > Document properties > Title 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

Other Forums: Access Forums

All times are GMT -7. The time now is 08:36 PM.


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