Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-18-2022, 02:59 AM
Bachelar Bachelar is offline Word VBA replicate Insert > Quick parts > Document properties > Title Windows 10 Word VBA replicate Insert > Quick parts > Document properties > Title Office 2021
Novice
Word VBA replicate Insert > Quick parts > Document properties > Title
 
Join Date: May 2022
Posts: 3
Bachelar is on a distinguished road
Default 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.
Reply With Quote
  #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,969
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
Reply



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 11:07 AM.


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