Word document properties from excel

ldarley

Board Regular
Joined
Apr 10, 2012
Messages
106
Office Version
  1. 2019
  2. 2016
Hi all

I am trying to populate a word template document property (the title) from the value held in an excel range. My word template has the appropriate document property set up via the quick parts menu, but I can't seem to find how to write to this property from excel vba.

I've managed to open my template through createobject("Word.Application") but fail on this line (with WDoc) defined as an object

WDoc.BuiltinDocumentProperties(wdPropertyTitle).Value = Dossier.Range("C2"), I get a run time error 5 invalid call procedure.

Could anyone let me know what the code should be?

Thanks
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
wdPropertyTitle is a Word constant that your code may not be recognising

Try both of these:
wdDoc.BuiltinDocumentProperties(1).Value = Dossier.Range("C2")
wdDoc.BuiltinDocumentProperties("Title").Value = Dossier.Range("C2")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,579
Members
452,653
Latest member
craigje92

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top