viper34j Posted June 17, 2009 Posted June 17, 2009 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?
water Posted June 17, 2009 Posted June 17, 2009 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 2024-07-28 - Version 1.6.3.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 (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
viper34j Posted June 17, 2009 Author Posted June 17, 2009 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.
water Posted June 17, 2009 Posted June 17, 2009 _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 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
viper34j Posted June 17, 2009 Author Posted June 17, 2009 (edited) 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 June 17, 2009 by viper34j
viper34j Posted June 23, 2009 Author Posted June 23, 2009 Anybody have any insights on how I can accomplish this?
jafox Posted March 10, 2010 Posted March 10, 2010 Viper, were you ever able to make changes to custom properties using autoit? Thanks
pcjco Posted May 14, 2020 Posted May 14, 2020 MsoDocProperties enumeration (Office) You should replace the type Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString by its enumeration value (4) msoPropertyTypeBoolean = 2 msoPropertyTypeDate = 3 msoPropertyTypeFloat = 5 msoPropertyTypeNumber = 1 msoPropertyTypeString = 4
water Posted May 14, 2020 Posted May 14, 2020 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 2024-07-28 - Version 1.6.3.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 (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
pcjco Posted May 22, 2020 Posted May 22, 2020 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now