Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create a Macro to run a Batch File

How Can I execute a batch file inside a macro?

I'm creating a Run Method (Windows Script Host) to execute the batch file but it doesn't run...

Have anyone already create a macro to run a batch file successfully? Or have a better ideia to run the script of a batch file?

Thanks!

14 Replies
Not applicable
Author

I think I don't understand very well:

SUB Run

ActiveDocument.ReloadEx 0,1

Set obj = createobject("Wscript.Shell")

obj.Run chr(34) & "PATH\teste.bat" & chr(34), 0, true

Set obj = Nothing

END SUB

The window it still appear

Thanks very much!

sinanozdemir
Specialist III
Specialist III

What is the trigger that you are choosing to run the macro?

I just tried it on "OnOpen" and the window didn't appear.

Not applicable
Author

It's strange because when I save the application and I reset the application to aperece window with the execution of the script . If you close the application without saving , and re-do reset , the window no longer appears ... Very strange

sinanozdemir
Specialist III
Specialist III

What are the module and local security setting in the Edit Module screen?

Capture.PNG

Not applicable
Author

I have the same but sometimes it change to default current local security value (Security Mode)