shell
-
Dear All I had used following code in VB6.0 to open test document through shell and I got following error.... Code: Shell "C:\shashi\test.doc" Error: Invalid procedure call or argument Code: Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & "C:\shashi\test.doc" Error: File Not Found Please help......
-
Dear All I had used following code in VB6.0 to open test document through shell and I got following error.... Code: Shell "C:\shashi\test.doc" Error: Invalid procedure call or argument Code: Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & "C:\shashi\test.doc" Error: File Not Found Please help......
-
Dear All I had used following code in VB6.0 to open test document through shell and I got following error.... Code: Shell "C:\shashi\test.doc" Error: Invalid procedure call or argument Code: Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & "C:\shashi\test.doc" Error: File Not Found Please help......
-
Shazz Rock wrote:
Code: Shell "C:\shashi\test.doc"
You'll have to use
ShellExecuteEx
to do that.thanx... do i hav to add preference or component.... if not then sorrrry to say it didn't work... please give another solution....
-
I think you are missing a space before the file name, so what you have is winword.exeC:\shashi\test.doc so try
Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & " C:\shashi\test.doc"
Bob Ashfield Consultants Ltd
thanx for reply... same error again actually there is no sapce present...
-
Dear All I had used following code in VB6.0 to open test document through shell and I got following error.... Code: Shell "C:\shashi\test.doc" Error: Invalid procedure call or argument Code: Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & "C:\shashi\test.doc" Error: File Not Found Please help......
Shazz Rock wrote:
Shell "C:\shashi\test.doc" Error: Invalid procedure call or argument
There's only a couple of reasons this would have failed. The first is if the file path doesn't exist. The second is if there is a problem with the extension association (.doc) with an application. But, in this case, you would not have gotten the error you did.
Shazz Rock wrote:
Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & "C:\shashi\test.doc" Error: File Not Found
It didn't work because you tried to execute something called
Program
, with the command line parameters ofFiles\Microsoft
andOffice\OFFICE11\winword.exe
andC:\shashi\test.doc
. Spaces, anywhere in the command line, are treated as delimiters. You need to wrap full path specifications in double quotes so they are treated as a single component of the command line. Your code should be closer to:Shell """C:\\Program Files\\Microsoft Office\\OFFICE11\\winword.exe"" & \_ " " & """C:\\shashi\\test.doc"""
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
thanx... do i hav to add preference or component.... if not then sorrrry to say it didn't work... please give another solution....