Jump to content
Sign in to follow this  
viper34j

Set custom properties on a newly created word document

Recommended Posts

viper34j

I need some pointers for setting custom properties on a newly created word document. I know how to set the regular properties, and I know how to create a macro in Word that will set the custom properties, but I can't figure out how to get an autoit script to set the custom properties at the time of the document creation.

Any ideas?

Share this post


Link to post
Share on other sites
water

Would the UDF word.au3, function _WordDocPropertySet help?

Details can be found in the Autoit help -> User defined functions -> Word management


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
viper34j

Would the UDF word.au3, function _WordDocPropertySet help?

Details can be found in the Autoit help -> User defined functions -> Word management

_WordDocPropertySet only works for the default list of Word Document properties. Custom properties work like a hashtable, you can set the name of the property and its value.

Is it possibly to save a macro to a word document via autoit? If so, I could create the macro that sets the custom property, then run the macro, and then remove it from the document.

Share this post


Link to post
Share on other sites
water

_WordDocPropertySet only works for the default list of Word Document properties. Custom properties work like a hashtable, you can set the name of the property and its value.

I see.

So I would check the _WordDocPropertySet function to see how Autoit can access Word document properties. Then I would have a look at this MS site to see how custom properties can be accessed using VB. The remainder should be easy :D


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
viper34j

So... found this in the MSDN...

$oDoc.CustomDocumentProperties.Add("Country", False, Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString, "US Only")

Obviously the type "Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString" is not going to be recognized in Autoit automagically. Any idea how I can pass this to the Add method?

Edited by viper34j

Share this post


Link to post
Share on other sites
viper34j

Anybody have any insights on how I can accomplish this?

Share this post


Link to post
Share on other sites
jafox

Viper, were you ever able to make changes to custom properties using autoit?

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×