Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Syntax of shell function with multiple parameters.

Posted on 2008-06-23
7
Medium Priority
?
656 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 150 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

916 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