View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Problem with Shell command

"Chip Pearson" wrote in message news:Ou7tJr%
If I recall correctly, the "Start" program was only in Windows 9x
versions. I don't think it was ever in NT (including XP) versions.


After doing a bit of research and testing, I find that I was wrong. Start is
available, but it is a cmd command, not an exe file. That's why its
available in a cmd window but not with Shell. Shell can't find a file named
"Start" so you get the "file not found" error on "Start" not your Target
file.

I knew there was something odd about Start on NT systems, I just forgot the
details. Your approach using ShellExecute or using my approach with
FindExecutable should work in any environment.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Chip Pearson" wrote in message
...
If I recall correctly, the "Start" program was only in Windows 9x
versions. I don't think it was ever in NT (including XP) versions. The
"file not found" error is not referring to the file named in Target, but
rather the "Start" program.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Andrew Hall NZ" wrote in message
...
I want to be able to open some pdf and htm files from Outlook and from
xcel.
I am using

Sub testsh()
Dim target As String
target = "C:/vba/copy7.htm"
Shell "Start " & target
End Sub

This fails with "file not found"

Given that I have successfully opened the file to read the text from
excel
and also that it runs fine from cmd.exe, I know the path is right. Is
there
some security setting or reference that is missing? This problem occurs
regardless of the file I attempt to target. I am running XP in Classic
mode.

TIA

Andrew