By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,224 Members | 1,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,224 IT Pros & Developers. It's quick & easy.

Shell Path problem

P: n/a
Hello

I am using the Shell command and having problems writing the path of some
arguments

Example:

Dim MyPath as String

MyPath = "C:\Program Files\Microsoft Office\Office\MSAccess.exe C:\Program
Files\MyData.mdb"

A = Shell(MyPath, 1)

Because of the space between (Program) and (Files) in C:\Program
Files\MyData.mdb the Shell

command looks for a database called C:\Program.mdb.

It doesn't seem to mind the space between (Program) and (Files) and

the space between (Microsoft) and (Office) in the path to MSAccess.exe.

I must be missing some brackets or quotation marks in the path that would
allow

Shell to recognize the full path of the mdb.

Thanks

G.Gerard
Dec 7 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
G Gerard wrote:
Hello

I am using the Shell command and having problems writing the path of some
arguments

Example:

Dim MyPath as String

MyPath = "C:\Program Files\Microsoft Office\Office\MSAccess.exe C:\Program
Files\MyData.mdb"

A = Shell(MyPath, 1)

Because of the space between (Program) and (Files) in C:\Program
Files\MyData.mdb the Shell

command looks for a database called C:\Program.mdb.

It doesn't seem to mind the space between (Program) and (Files) and

the space between (Microsoft) and (Office) in the path to MSAccess.exe.

I must be missing some brackets or quotation marks in the path that would
allow

Shell to recognize the full path of the mdb.

Thanks

G.Gerard

Try this.

In the path to Access ("Office" Vs. "Office10") YMMV. Watch for word
wrap and the trailing space in the path to the EXE.

MyPath = "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE " &
"""" & "C:\blahblahblah\MyAccessDB.mdb" & """"
--
Smartin
Dec 8 '06 #2

P: n/a
You need to insert double quotes around the mdb path and name, as this is in
a string you have to double them up, so:-

Dim MyPath as String

MyPath = "C:\Program Files\Microsoft Office\Office\MSAccess.exe ""C:\Program
Files\MyData.mdb"""


--

Terry Kreft
"G Gerard" <gg*****@nbnet.nb.cawrote in message
news:7a*******************@ursa-nb00s0.nbnet.nb.ca...
Hello

I am using the Shell command and having problems writing the path of some
arguments

Example:

Dim MyPath as String

MyPath = "C:\Program Files\Microsoft Office\Office\MSAccess.exe C:\Program
Files\MyData.mdb"

A = Shell(MyPath, 1)

Because of the space between (Program) and (Files) in C:\Program
Files\MyData.mdb the Shell

command looks for a database called C:\Program.mdb.

It doesn't seem to mind the space between (Program) and (Files) and

the space between (Microsoft) and (Office) in the path to MSAccess.exe.

I must be missing some brackets or quotation marks in the path that would
allow

Shell to recognize the full path of the mdb.

Thanks

G.Gerard


Dec 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.