How to use Call Shell to run a VB execute file with arguments

  • Thread starter zixingw via AccessMonster.com
  • Start date
Z

zixingw via AccessMonster.com

When I run a VB exeucte file with Call Shell as follows:

Call Shell("""C:\Program Files\Microsoft Office 97\Office\micaccss.EXE""", 1).


The error message says: File not find.

When I use Windows 2000 to directly run micaccess.exe, the message from this
application says:

Please use this application with two command line arguments: 'Name and path
to the schedule database and to results database.

Two database are as follows

L:\Raritan-MICACCESS\MIC-Access v20\data.mdb

L:\Raritan-MICACCESS\MIC-Access v20\schedul.mdb

How to code these two databases in Call Shell
 
D

Douglas J. Steele

zixingw via AccessMonster.com said:
When I run a VB exeucte file with Call Shell as follows:

Call Shell("""C:\Program Files\Microsoft Office 97\Office\micaccss.EXE""",
1).


The error message says: File not find.

Likely because the executable file for Access is msaccess.exe, not
micaccss.exe
When I use Windows 2000 to directly run micaccess.exe, the message from
this
application says:

Please use this application with two command line arguments: 'Name and
path
to the schedule database and to results database.

Two database are as follows

L:\Raritan-MICACCESS\MIC-Access v20\data.mdb

L:\Raritan-MICACCESS\MIC-Access v20\schedul.mdb

How to code these two databases in Call Shell

No need to use Shell at all. try:

Application.FollowHyperlink "L:\Raritan-MICACCESS\MIC-Access v20\data.mdb"

and

Application.FollowHyperlink :L:\Raritan-MICACCESS\MIC-Access
v20\schedul.mdb"

(Note: there will probably be word-wrap associated with the answers above.
Both should be single lines: the command Application.FollowHyperlink,
followed by a space, followed by the name of the database enclosed in the
quotes)
 
Z

zixingw via AccessMonster.com

Dougles,

The reason to run micaccess.exe is that micaccess is a database application
coded by VB. It uses
two databases at its backend. The application micaccess is installed in PC
and the database is
located in company LAN data server.

Usually, we run micaccess from Windows: Start ==> Program ==> MICACCESS. My
department wants to run micaccess from a button on an Access 97 form, so I
have to use Call Shell

Thanks

Zixing
When I run a VB exeucte file with Call Shell as follows:

Call Shell("""C:\Program Files\Microsoft Office 97\Office\micaccss.EXE""",
1).

The error message says: File not find.

Likely because the executable file for Access is msaccess.exe, not
micaccss.exe
When I use Windows 2000 to directly run micaccess.exe, the message from
this
[quoted text clipped - 11 lines]
How to code these two databases in Call Shell

No need to use Shell at all. try:

Application.FollowHyperlink "L:\Raritan-MICACCESS\MIC-Access v20\data.mdb"

and

Application.FollowHyperlink :L:\Raritan-MICACCESS\MIC-Access
v20\schedul.mdb"

(Note: there will probably be word-wrap associated with the answers above.
Both should be single lines: the command Application.FollowHyperlink,
followed by a space, followed by the name of the database enclosed in the
quotes)
 
D

Douglas J. Steele

I see. So your question is how to pass the two database paths to the Shell
command?

Dim strCommand As String

strCommand = """C:\Program Files\Microsoft Office
97\Office\micaccess.EXE""" & _
" ""L:\Raritan-MICACCESS\MIC-Access v20\data.mdb"", " & _
"L:\Raritan-MICACCESS\MIC-Access v20\schedul.mdb"""
Call Shell(strCommand, 1)

(I've assumed there's supposed to be a comma between the two database
paths.)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


zixingw via AccessMonster.com said:
Dougles,

The reason to run micaccess.exe is that micaccess is a database
application
coded by VB. It uses
two databases at its backend. The application micaccess is installed in PC
and the database is
located in company LAN data server.

Usually, we run micaccess from Windows: Start ==> Program ==> MICACCESS.
My
department wants to run micaccess from a button on an Access 97 form, so I
have to use Call Shell

Thanks

Zixing
When I run a VB exeucte file with Call Shell as follows:

Call Shell("""C:\Program Files\Microsoft Office
97\Office\micaccss.EXE""",
1).

The error message says: File not find.

Likely because the executable file for Access is msaccess.exe, not
micaccss.exe
When I use Windows 2000 to directly run micaccess.exe, the message from
this
[quoted text clipped - 11 lines]
How to code these two databases in Call Shell

No need to use Shell at all. try:

Application.FollowHyperlink "L:\Raritan-MICACCESS\MIC-Access v20\data.mdb"

and

Application.FollowHyperlink :L:\Raritan-MICACCESS\MIC-Access
v20\schedul.mdb"

(Note: there will probably be word-wrap associated with the answers above.
Both should be single lines: the command Application.FollowHyperlink,
followed by a space, followed by the name of the database enclosed in the
quotes)
 

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