Jump to content

Set custom properties on a newly created word document


Recommended Posts

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?

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

_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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 8 months later...
  • 10 years later...

You did notice that this thread has been silent for more than 10 years?
Most users have been absent for the same time.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I did noticed. But as I was dealing with the same question as OP and found this topic by searching, I posted the solution so that the next guy that search for this issue will found a topic with a solution proposed.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...