> Shell "Notepad.exe C:\Program
Files\Test.txt",VbNormalFocus
But here is the problem in the space of the "Program
Files" folder, ie, "Program[SPACE]Files". The Shell
function not reading any character after the SPACE.
Mr. Wagner's response is probably a better way, but here's the rundown on
the spaces:
When you called shell, you passed it a command line that is interpreted by
the operating system:
Notepad.exe C:\Program Files\Test.txt
According to the way the operating system parses command lines, you have
specified 3 tokens:
1. Notepad.exe
2. C:\Program
3. Files\Test.txt
The operating system recognises the first as a program, finds it in the
path, and executes it, passing the other two tokens as two command line
parameters. Notepad thinks that "c:\program" is the name of the file you
want to open.
To prevent this, any file system references can be enclosed in double quotes
so that the operating system doesn't misinterpret the meaning of the embeded
spaces, like this (you can actually try this in a Start -> Run box):
Notepad.exe "C:\Program Files\Test.txt"
The way you would issue your shell statement to include the quotes as part
of the string is to use two double quotes for each double quote that you
want inside the string:
Dim s As String
s = "Notepad.exe ""C:\Program Files\Test.txt"""
MessageBox.Show(s) 'Note the way the quotes are embedded
Shell(s, AppWinStyle.NormalFocus)
This quote technique works anywhere in Windows where the operating system or
a [well written] program expects a path or filename.
--
Peace & happy computing,
Mike Labosh, MCSD MCT
Owner, vbSensei.Com
"Escriba coda ergo sum." -- vbSensei