I'm trying to use a command line tool called pdf toolkit to merge files in VBA.
I've successfully run it in a command window so I thought it would be easy to call a shell to run it in vba.
Dim sDir As String
Dim sFileA As String
Dim sFileB As String
Dim sOutput As String
sDir = Range("B2")
sFileA = Range("B3")
sFileB = Range("B4")
sOutput = Range("B5")
Open sDir & "\" & "temp.bat" For Output As #1
Print #1, "cd " & sDir
Print #1, "pdftk " & sFileA & " " & sFileB & " cat output " & sOutput
Shell sDir & "\" & "temp.bat"
This runs without error but does not create the merge file. If I double click the temp.cmd file generated it successfully creates the merge file. So the syntax of the file should be ok. Can anyone give me a suggestion?