I have code as follows:
ChDir (ActiveWorkbook.Path)
ShellString = "cmd.exe /k cpdf -split " + Chr(34) + ".\" + Replace(File, ".csv", ".pdf") + Chr(34) + " -o temp/x_%%%.pdf"
Shell ShellString, vbNormalFocus
When I run the code, it does nothing, because it can't find cpdf.exe.
Cpdf.exe exists in the same path as my Active Workbook. The ChDir command did not do the trick.
When I run the code, I get
'cpdf' is not recognized as an internal command....
And I am left at the following prompt:
C:\Users\ksmith\Documents
This tells me that the command was trying to run from that folder, and that is why it failed.
How do I run Shell from Desired folder in VBA? ChDir doesn't seem to do the trick, as some people had suggested...
"L:\Temp1\Temp2"then you also need toChDrive "L"for theChDirto be useful because the o/s keeps track of the "current" directory on each drive and the default is to use the "current" directory on the "current" drive.)