Sign in to follow this  
Followers 0
Thomymaster

how to pass parameters to a VBA function?

3 posts in this topic

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")?

Share this post


Link to post
Share on other sites



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.

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  
Followers 0