Solved

Syntax of shell function with multiple parameters.

Posted on 2008-06-23
7
646 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 VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

920 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

15 Experts available now in Live!

Get 1:1 Help Now