Calling batch file from VBA

dantheram

Board Regular
Joined
Aug 27, 2010
Messages
187
This task was driving me insane earlier, here's what i had -

bat file -

copy *.csv all.csv
pause

excel


Dim retValretVal = Shell("filePath")</pre>

now this opened the bat file but ran it on my H:\ directory and not the location of the excel file and the bat file (a folder on my desktop)

what is the correct code?

Thanks

Dan
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

dantheram

Board Regular
Joined
Aug 27, 2010
Messages
187
there should be a rtn in the excel part -

sub bat()
dim retVal
retVal = Shell("filepath")
end sub
 

Watch MrExcel Video

Forum statistics

Threads
1,109,043
Messages
5,526,423
Members
409,701
Latest member
nitmani

This Week's Hot Topics

Top