Solved

Syntax of shell function with multiple parameters.

Posted on 2008-06-23
7
648 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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.

770 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