Trigger A Batch File From VB Button (1 Viewer)

CharlesWhiteman

Registered User.
Local time
Today, 03:16
Joined
Feb 26, 2007
Messages
421
Hi All, I am using the following code to execute a batch file. The batch file runs a SQL script which in turn produces a CSV file.

My batch file runs but doesnt produce the CSV file. The batch file works if triggered manually.

Any help much appriciated.

Code:
Dim wshThisShell As WshShell
Dim lngRet As Long
Dim strShellCommand As String
Dim strBatchPath As String
wshThisShell = New WshShell
strBatchPath = "C:\RemoteListUpdate\ClientID1.bat"
'the path for the batch file you're using 
strShellCommand = """" & strBatchPath & """"
'the ridiculous number of quotation marks is necessary
'when there is a space in one or more of the folder names
lngRet = wshThisShell.Run(strShellCommand, vbNormalFocus, vbTrue)
'set 3rd argument above to vbFalse for asynchronous
'execution of the batch file.
 

Users who are viewing this thread

Top Bottom