trying to get Error Number

J

John

I have a .chm that is called by a cmdButton:

Shell "HH.exe " & CurrentProject.Path & "\myfile.chm", vbNormalFocus

which works, fine, but am trying to give User more info if they delete or move
the .chm file from ProjectPath.

When I try to get an Error number by renaming the chm, I get a dialog box with
"Help" as the title, and just a line that says:
Cannot open the file: (path)\myfile.chm.
It appears that the help compiler generated the diaglog box?

Is there a particular error I can trap to generate a more detailed error
message, or should I just check to see if the file exists in the proper location
before calling the chm file. If the latter, how do I do that?

Thanks, John
 
K

Ken Snell \(MVP\)

You can use the Dir function to see if the file exists where you think it
should be:

If Dir("C:\PathToFile\Filename.chm") = "" Then
MsgBox "Cannot find the .chm file!"
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top