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

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
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,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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