Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA "Shell script.vbs > textfile.txt" not working 1

Status
Not open for further replies.

Divercem

IS-IT--Management
Apr 2, 2007
39
US
I have the following code that works directly from a command prompt, but doesn't work from Excel VBA:
Code:
retVal = Shell("cscript C:\Scripts\Exchange\Mailbox_Sizes_Info.vbs > C:\Scripts\Exchange\Mailbox_Sizes_Info.txt")
if I remove the redirected output the script runs in the command window, but I don't know how to capture it other than redirecting to a file.

Any help is definitely appreciated. :eek:)
 
Code:
retVal = Shell("[!]cmd /c [/!]cscript C:\Scripts\Exchange\Mailbox_Sizes_Info.vbs > C:\Scripts\Exchange\Mailbox_Sizes_Info.txt")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That did it! That's all it took? I've been banging on this snippet of code for a couple of days and didn't find the cmd /c comment anywhere.

Thanks so much!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top