Problems with Shell Method

G

Gibson

Using a Access2003 database in WinXP I am trying to shell over to a third
party software to run it. I am using the code line.
Dim Test
Test = Shell("C:\Directory\File.EXE Config1.XXX")

The 3rd party software is installed in the same directory as the database.
The problem is when the File.Exe runs it looks for other files to load and
claims it can't find them. It claims it can't find file Config1.XXX when it
is there. Apparently File.exe thinks it is running somewhere else than in
its directory. When I create a shortcut on the desktop to run the File.EXE
it works fine. Is there a way to shell to a desktop shortcut? I'd rather
not have my clients have to alt-tab out of the database to the desktop to
run this program

Thanks
 
D

Dirk Goldgar

Gibson said:
Using a Access2003 database in WinXP I am trying to shell over to a
third party software to run it. I am using the code line.
Dim Test
Test = Shell("C:\Directory\File.EXE Config1.XXX")

The 3rd party software is installed in the same directory as the
database. The problem is when the File.Exe runs it looks for other
files to load and claims it can't find them. It claims it can't find
file Config1.XXX when it is there. Apparently File.exe thinks it is
running somewhere else than in its directory. When I create a
shortcut on the desktop to run the File.EXE it works fine. Is there
a way to shell to a desktop shortcut? I'd rather not have my clients
have to alt-tab out of the database to the desktop to run this program

Thanks

Try specifying the path to the Config1.XXX file in the Shell
command-line argument:

Test = Shell("C:\Directory\File.EXE C:\Directory\Config1.XXX")

If the directory path contains spaces, you may need to specify quotes
around it:

Test = Shell("C:\Directory\File.EXE ""C:\Directory\Config1.XXX""")

If none of that works, it may be that the program always looks in the
Windows current directory, which isn't necessarily the same as the one
your database is in. You might then try:

ChDir "C:\Directory"
Test = Shell("C:\Directory\File.EXE Config1.XXX")

These are all just ideas, but they may be worth trying.
 
P

Paul Overway

Try this:

Test = Shell(Chr(34) & "C:\Directory\File.EXE" & Chr(34) &" " & Chr(34) &
"Config1.XXX" & Chr(34))
 
G

Gibson

Thanks for the quick response. Alas all three suggestions have the same
result. The .exe files finds the config file but when it runs is still
believes it is running somewhere other than is directory and claims it can't
load the appropriate files and drivers. I even set up a .cmd file that runs
the .exe file and tried to shell to it with no luck. Is there a alternative
for Shell or a means to Shell to a shortcut located on the Desktop. The
..exe file works great from a desktop shortcut.

Thanks
 
D

Dirk Goldgar

Gibson said:
Thanks for the quick response. Alas all three suggestions have the
same result. The .exe files finds the config file but when it runs is
still believes it is running somewhere other than is directory and
claims it can't load the appropriate files and drivers. I even set
up a .cmd file that runs the .exe file and tried to shell to it with
no luck. Is there a alternative for Shell or a means to Shell to a
shortcut located on the Desktop. The .exe file works great from a
desktop shortcut.

Check out the shortcut and see what it says in the "Start in" box.
Maybe it's running the program in a particular folder.
 
G

Gibson

The "Start In" line indicates that it is starting in the directory I pathed
to. The directory the database is in.
 
D

Dirk Goldgar

Gibson said:
The "Start In" line indicates that it is starting in the directory I
pathed to. The directory the database is in.

I'm at a loss, then. If you can, please post the complete properties
from the "Shortcut" tab of the shortcut's property sheet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top