doubledaffy
Board Regular
- Joined
- Jan 22, 2010
- Messages
- 172
I'm trying to run a batch file from VBA and the batch file works fine when run independently. As a side note, the batch file uses FTP and gets a text file from a server which is later used by excel. The text file is "INVRPT"
Here is the code I have:
I do not get any errors, and a command prompt does pop up shortly, however the text file does not get updated. When the batch file runs on its own, INVRPT gets updated, but through the shell command it does not. Any thoughts?
Thanks
Here is the code I have:
Code:
WBlocation = ThisWorkbook.FullName 'Generate file directory
WBname = ThisWorkbook.Name 'Current File Name
Truncnum = InStr(WBlocation, WBname) - 1 'Where to cut the directory
Dim BatchL As String
BatchL = Left(WBlocation, Truncnum) & "getrpt.bat" 'Batch file path location
Statusnum = Shell(BatchL)
DoEvents
I do not get any errors, and a command prompt does pop up shortly, however the text file does not get updated. When the batch file runs on its own, INVRPT gets updated, but through the shell command it does not. Any thoughts?
Thanks