View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Problem opening .htm file from Excel 2000

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 Jordan wrote:
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 a-

.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