Problem opening .htm file from Excel 2000

  • Thread starter Thread starter Charles Jordan
  • Start date Start date
C

Charles Jordan

Hi. I am having a problem, I think in migrating an application which
is successful on one PC (PC "A", running Windows ME) to another PC
("B" running Windows XP).

(1) On PC "A" we have developed an Excel 2000 file which in all
respects works fine. In particular, as a menu option, it will open an
..htm help file that I wrote and saved in Word 2000 (of about 100 kb).

(2) I then wrote an install programme in VBA which successfully
creates a folder hierarchy on "B" , and copies .xls, .gif, .xla files
from a CD, all installed in the correct places. In all cases I used
Easy CD creator to copy the files to the CD. The install programme
programme on the CD, "Setup.xls" , then copies all the files.

(3) On PC "B", the workbook fires up just fine, but when we press the
help file menu option, it fails to start up Internet Explorer, and
thus present the Help file. The 2 lines of code in question are:-

..URL = "C:\Data\Htm\Chapter1text.htm"
X = Shell("start " & URL, 2)

Given that this code works fine on PC "A", and not on "B", it makes me
think that some files or links are not getting copied from "A" onto
the CD, so that the Shell command is failing. Or does Shell not work
in Windows XP ?

On PC "B", the file list appears to be exactly the same, and in the
same folders as on "A" and includes:-

Header.htm
filelist.xml
and many image.gif files (about 40).

It it therefore possible to move this application simply by copying
fles with Easy CD Creator, as I have done ?


Thanks in advance - I have a large number of students due to get the
whole install in about 10 days time ! Charles Jordan
 
Hi Charles,

Shelling a "start" command doesn't work on my system (XP), but I haven't
used it much, so there may be a way to get it to work. Alternatively, you
could use the ShellExecute API call to do this:

Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Sub test()
Dim URL As String
Dim x As Long

URL = "C:\Data\Htm\Chapter1text.htm"
x = ShellExecute(0, vbNullString, URL, _
vbNullString, "C:\Data\Htm", 1)
End Sub

This method should work on all Win32 systems. You can check the return code
to see if it was successful.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
Jake Marx said:
Hi Charles,

Shelling a "start" command doesn't work on my system (XP), but I haven't
used it much, so there may be a way to get it to work. Alternatively, you
could use the ShellExecute API call to do this:

Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Sub test()
Dim URL As String
Dim x As Long

URL = "C:\Data\Htm\Chapter1text.htm"
x = ShellExecute(0, vbNullString, URL, _
vbNullString, "C:\Data\Htm", 1)
End Sub

This method should work on all Win32 systems. You can check the return code
to see if it was successful.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Charles said:
Hi. I am having a problem, I think in migrating an application which
is successful on one PC (PC "A", running Windows ME) to another PC
("B" running Windows XP).

(1) On PC "A" we have developed an Excel 2000 file which in all
respects works fine. In particular, as a menu option, it will open an
.htm help file that I wrote and saved in Word 2000 (of about 100 kb).

(2) I then wrote an install programme in VBA which successfully
creates a folder hierarchy on "B" , and copies .xls, .gif, .xla files
from a CD, all installed in the correct places. In all cases I used
Easy CD creator to copy the files to the CD. The install programme
programme on the CD, "Setup.xls" , then copies all the files.

(3) On PC "B", the workbook fires up just fine, but when we press the
help file menu option, it fails to start up Internet Explorer, and
thus present the Help file. The 2 lines of code in question are:-

.URL = "C:\Data\Htm\Chapter1text.htm"
X = Shell("start " & URL, 2)

Given that this code works fine on PC "A", and not on "B", it makes me
think that some files or links are not getting copied from "A" onto
the CD, so that the Shell command is failing. Or does Shell not work
in Windows XP ?

On PC "B", the file list appears to be exactly the same, and in the
same folders as on "A" and includes:-

Header.htm
filelist.xml
and many image.gif files (about 40).

It it therefore possible to move this application simply by copying
fles with Easy CD Creator, as I have done ?


Thanks in advance - I have a large number of students due to get the
whole install in about 10 days time ! Charles Jordan

Jake - thanks. Hope you had a great Thanksgiving. Your fix worked
brilliantly first time!. But please what is, and how do I "check the
return code" ??
 
Hi Charles,
Jake - thanks. Hope you had a great Thanksgiving. Your fix worked
brilliantly first time!. But please what is, and how do I "check the
return code" ??

Yes I did - ate way too much. Hope you had a great Thanksgiving, too.

In this case, the return code is the value that will be assigned to the
variable x. There are many constants declared in the Windows API that you
can compare this return code with.

Here's a link to the MSDN description of ShellExecute:

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp

A VB example is here:

http://www.mvps.org/access/api/api0018.htm

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
Back
Top