Thomymaster Posted September 16, 2014 Share Posted September 16, 2014 Hi I have the following VBA statement which i want to run through AutoIT via COM ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges I have this in AutoIT which works: $oWord = ObjCreate("Word.Application") $oWord.ActiveDocument.close But how can i append the VBA function parameter ("SaveChanges=False")? Link to comment Share on other sites More sharing options...
step887 Posted September 16, 2014 Share Posted September 16, 2014 Autoit has a build in UDF for working with Word Docs https://www.autoitscript.com/autoit3/docs/libfunctions/_Word_DocClose.htm Link to comment Share on other sites More sharing options...
Thomymaster Posted September 18, 2014 Author Share Posted September 18, 2014 Thanks, i didn't know that. By the way i found out that you have to use exactly the same order of parameters to pass to the VBA method. In case you have VBA constants, you have to look them up via pressing F2 in the VBA editor So in my example (but there is an official function for that would be: $oWord.ActiveDocument.close(0,2,0) You always have to pass the complete parameters in the correct order to the function call if you use it like above. You can get the defaults from the Microsoft documentation. Link to comment Share on other sites More sharing options...
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