Link to home
Start Free TrialLog in
Avatar of Sar1973
Sar1973Flag for Italy

asked on

Syntax of shell function with multiple parameters.

Does anybody know how can I convert the following content of a .bat file to the argument of a Shell function? In other words, I want to call/execute this exact content with VBA:
C:\Programs\omniformat\omniformat.exe "C:\Mailing\myLetter.doc" "JPG"
Thanx.
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Sar1973,

You should be able to simply run the batch file from the shell command.

So leave your batch file as is, and "call" it with the shell command from your VBA code.
Like so:

Shell "C:\YourFolder\YourBatchFile.bat"

JeffCoachman
Avatar of Sar1973

ASKER

The only problem is that the instructions included in the batch file change for each document I would like to merge. Could you then provide a code to generate batch files?
Sar1973,

<the instructions included in the batch file change for each document I would like to merge.>

OK, this is new information.
What are these "instructions" that will change?

Now I will presume that the Path/Filename (C:\Mailing\myLetter.doc) and the Extension (JPG) will be the "Instructions" that will be changing.
I will also presume that these values are listed in a two textboxes on your form.
So you would use something like this:
Shell "C:\Programs\omniformat\omniformat.exe" & " " & me.txtYourFilePathAndFullFileName & " " & me.txtFileExtension

So in this case: C:\Mailing\myLetter.doc
is stored in txtYourFilePathAndFullFileName
...and: JPG
is stored in txtFileExtension

JeffCoachman
Avatar of Sar1973

ASKER

Found it: it needs Chr(34) instead of & " ". Thanx.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sar1973

ASKER

I agree, sorry. It's only that I'm getting mad on some code in these days, hope you understand.
< hope you understand.>

Yep.
;-)


Jeff