View Single Post
 
Old 05-18-2022, 05:11 AM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
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