I'm trying to execute a command line command from within VBA to combine PDFs. I have a tool called pdftk that'll take 2 input files and combine them into one. It has a command structure of:
pdftk "input file1" "input file2" output "output file"
Here's an example of one that works just fine from a command window:
pdftk "F:\Donor Central\Scripts\Joel's COE Test Folder\LC-SJL1046.pdf" "F:\Donor Central\Scripts\Joel's COE Test Folder\LC-SJx1046.pdf" output "C:\_My Files\_My OCCF Files\SugarSyncTemp\combinedx.pdf"
Now for the VBA code and my frustration:
This works fine as well:
But when I want to use variable substitution I can't get it to work at all: Here's my code:
If I look at the variable ZZ in the immediate window it looks the same as what's in the Shell command, yet it doesn't work.
It would be great if I could pause the DOS command window after the command executed to see what's wrong, but even when I do a Call Shell it executes and immediately flashes away. Is there a way to stop the command window from closing so fast?
Really, my question is, what's wrong with my variable substitution and why won't it work? I sure would appreciate the help.
Bookmarks