Re: Problem with Shell command



"Chip Pearson" <chip@xxxxxxxxxxxx> 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" <chip@xxxxxxxxxxxx> wrote in message
news:Ou7tJr%23GHHA.1252@xxxxxxxxxxxxxxxxxxxxxxx
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" <AndrewHallNZ@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:87041433-FBC3-464D-9AB4-E40BED16AC53@xxxxxxxxxxxxxxxx
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





.



Relevant Pages

  • Re: Another Try - Calculate from ActiveCell
    ... By the way, if for some reason you ever select a cell in column A, the above ... Private Sub Worksheet_SelectionChange(ByVal Target As Range) ... I was going to use both Worksheet_Change & Workbook_Open in an Excel file ... "CNine" is in the same row as the ActiveCell, but always one column to the ...
    (microsoft.public.excel.programming)
  • Re: Another Try - Calculate from ActiveCell
    ... By the way, if for some reason you ever select a cell in column A, the above ... Private Sub Worksheet_SelectionChange(ByVal Target As Range) ... I was going to use both Worksheet_Change & Workbook_Open in an Excel file ... "CNine" is in the same row as the ActiveCell, but always one column to the ...
    (microsoft.public.excel.programming)
  • Re: find a value in a column, if it matched, highlight that column
    ... On the side, I really like to start learning how to write program in Excel, ... Private Sub Worksheet_Change(ByVal Target As Range) ... I understand that conditional formatting can be used to do just that. ... Select Patterns tab and choose another colour ...
    (microsoft.public.excel.programming)
  • Re: Problem mit Change--Ereignis bei Zelle
    ... Private Sub Worksheet_Change(ByVal Target As Range) ... Betriebssystem XP Pro SP2 und Excel Version 2003 SP2. ...
    (microsoft.public.de.excel)
  • Re: VBA cut and paste
    ... If the Target cell had formatting, Mike's code leaves that formatting in place whereas Cut would remove it. ... Rick (MVP - Excel) ...
    (microsoft.public.excel.programming)