View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Charles Jordan Charles Jordan is offline
external usenet poster
 
Posts: 56
Default Shell command stopped working: is it part of Excel 95 , or Windows?

"Tom Ogilvy" wrote in message ...
If Range("VersionNo").Value < 8 Then 'Excel version number
MsgBox XX

Exit Sub
Else

Would require that you have an application associated with the extension of
your file spec in Range("URL")

If not, then start wouldn't know what application to start. If that is the
case, it has nothing to do with reinstalling xl95

You don't need any libraries beyond VBA to sue the Shell command.

You said nothing happens. In my test:

Sub Tester9()
XX = Shell("start myfile.yyy", 2)
MsgBox XX

End Sub

Msgbox comes up with a number, but no application is started. I don't know
if that is what you are getting. (there is no application associated with
.yyy).

When multiple copies of Excel are installed, it is recommended by microsoft
that they be installed from oldest to newest. I can't tell you whether it
would be problematic to reinstall xl95, but I don't see any reason to do it.

--
Regards,
Tom Ogilvy


Tom thanks -
XX = Shell("start " & Range("URL").Value, 2)

Range("URL").value reads C:\Data\Htm\Chapter4Text.htm, and it all
fires up just fine with that code on Machine A so either we are
missing a library reference, or the XL95 installation is corrupted,
hnce my suggestion of reinstalling. But please could you let us
whether the above *code* looks OK ? and if not what extra should it
contain ?

Thanks Charles







"Charles Jordan" wrote in message
om...
(Charles Jordan) wrote in message

. com...
"Tom Ogilvy" wrote in message

...
Shell is a native command to VBA/VB

It is possible they are using that library, but seems unlikely. One

never
knows. Seems if that were the case, rather than nothing happens, they

would
get a missing library error message.

Tom thanks.
On machine A, it works under XP with no references to any library set
up .
On machine B, (again, XP, no references), it bombs with "Invalid
procedure call" at the line containing the Shell command. The .htm
file IS there, in the correct folder.

Where please can I find the setting or switch for "error suppression
in place " ?? We've not heard of it.

Our code is below this. Any more ideas ? Personally, I suspect that
the Excel 95 installation may have been corrupted, so if I reinstall
XL 95, have I then got to also reinstall Excel 2003 ? (which we need
on the same machine)

Thanks Charles

Sub NewOpenHTM()
Dim XX As Long
On Error Resume Next

Range("URL").Value = Range("Rootpath").Value & MyHtmpath & "\"
& ChosenHTMtext & ""

If Range("VersionNo").Value < 8 Then 'Excel version number
XX = Shell("start " & Range("URL").Value, 2)
MsgBox XX
Exit Sub
Else
ActiveDialog.Focus =
ActiveDialog.Buttons("ForwardButton").Name
Application.Run "V9addin.xla!GetTheHtm"
Exit Sub
End If
End Sub
'-----------------------------------



Tom Ogilvy - I don't know if you are on line, but

(1) will I do any harm if I reinstall Excel 95 on top of Excel 2003 ?

(2) Do we need any references to a library as Chris has suggested ?

Thanks - Charles