Computing.Net > Forums > Programming > Run/Open file in VBA

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Run/Open file in VBA

Reply to Message Icon

Name: Andy
Date: March 5, 2003 at 12:45:25 Pacific
OS: Win 2K
CPU/Ram: gig
Comment:

I'm writing a macro within excel and in that macro I would like to run a batch file. Could somebody please help me with the syntax?

Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: Jonathan Twynham
Date: March 6, 2003 at 04:02:45 Pacific
Reply:

Hey, simple bit of code here!!

in the macro, where you want to run the batch file, simply type:

Dim ReturnValue
ReturnValue = Shell("C:\FilenameOfBatch.bat",vbNormalFocus)

You can replace the vbNormalFocus for whatever you wish, so you can have it so that it is hidden, minimised, maximised etc, after you press the ',' key it will popup a menu and you can pick from that.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Run/Open file in VBA

C Code to run audio files in Linux www.computing.net/answers/programming/c-code-to-run-audio-files-in-linux/15521.html

Execute a file in VBA www.computing.net/answers/programming/execute-a-file-in-vba/7374.html

Passing an Open File in C++ www.computing.net/answers/programming/passing-an-open-file-in-c/17174.html