Filenames with spaces

R

raywo686794

What syntax is correct for use with the SHELL() function to open a filename
which contains spaces?
 
A

Alex Dybenko

Hi,
you need to add double quotes, like this:
?shell("C:\Program Files (x86)\Office2003\OFFICE11\MSACCESS.EXE " & """" &
"C:\Program Files (x86)\Microsoft Visual
Studio\MSDN98\98VSa\1033\Samples\VB98\misc\booksale\BOOKSALE.MDB" & """")


--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 
J

Jack Leach

Wrap them in quotes as you would a variable...

C:\Documents and Settings\SomeDoc.doc

Shell """C:\Documents and Settings\SomeDoc.doc"""



that's one set of double quotes on the inside, so vba reads it as:

"C:\Documents and Settings\SomeDoc.doc"

which is how you would have to refer to this for commandline functions


hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 

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