Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shell with two parameters

Status
Not open for further replies.

dendic

Programmer
Jan 19, 2003
106
US
Dim strCommand As String
Dim strVariableFrom, strVariableTo
strVariableFrom = "test.tif"
strVariableTo = "test.PDF"
strCommand = "c:\imagemagick\imagemagic\imconvert.exe" & " " & strVariableFrom & " " & strVariableTo
Shell ("Cmd /k" & strCommand)
The imconvert program uses to parameters from and to. It works from dos but can't get it working from access. The problem is the file names (strvariablefrom and strvariableto) have single quotes around them. Is there a way to send without the quotes? If not is there another way to run this executable program from access. It doesnt work as an activex in access 2010. It's registered fine but I get error activex control can't create object. Either way to get it working would be fine.
 
First, what you are saying is:
Dim strVariableFrom [red]As Variant[/red], strVariableTo [red]As Variant[/red]

Second, are you saying if you would do this:
? strCommand
you would get:

c:\imagemagick\imagemagic\imconvert.exe 'test.tif' 'test.PDF'

???

Have fun.

---- Andy
 
When I send to the shell:
strCommand = "c:\imagemagick\imagemagic\imconvert.exe" & " " & strVariableFrom & " " & strVariableTo
Dim strCommand As String
Dim strVariableFrom, strVariableTo
strVariableFrom = "test.tif"
strVariableTo = "test.PDF"

When it gets there it looks like this:
imconvert.exe 'test.tif' 'test.pdf'


It needs to be like this:
imconvert.exe test.tif test.pdf
 
When I do this:

Code:
Dim strCommand As String
Dim strVariableFrom As String, strVariableTo As String
strVariableFrom = "test.tif"
strVariableTo = "test.PDF"

strCommand = "imconvert.exe" & " " & strVariableFrom & " " & strVariableTo

Debug.Print strCommand

I get:
[tt]imconvert.exe test.tif test.PDF[/tt]

This is in VBA editor, right?

Have fun.

---- Andy
 
No it's in Command Prompt DOS. That's the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top