Solved

Syntax of shell function with multiple parameters.

Posted on 2008-06-23
7
645 Views
Last Modified: 2013-11-27
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.
0
Comment
Question by:Sar1973
  • 4
  • 3
7 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 21852226
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
0
 
LVL 9

Author Comment

by:Sar1973
ID: 21853461
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?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 21856543
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
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 9

Author Comment

by:Sar1973
ID: 21859243
Found it: it needs Chr(34) instead of & " ". Thanx.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 50 total points
ID: 21859824
Sar1973,

No offense but you post is just a tweak to my post.

And as such should not really qualify for *all* the points.

How about a 50/50 split?

JeffCoachman
0
 
LVL 9

Author Closing Comment

by:Sar1973
ID: 31469922
I agree, sorry. It's only that I'm getting mad on some code in these days, hope you understand.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 21861926
< hope you understand.>

Yep.
;-)


Jeff
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now