"Program Does Not Exist" message (2nd Post)

M

Mr. Smiley

PLEASE PLEASE PLEASE somebody help me figure this out. I have posted this
question twice already:

Hello. I have a command button on a form. Behind the button is code to
Application.FollowHyperlink stDocName

When the user presses the button, it is supposed to follow a hyperlink
created from the text in certain fields on the form to open a file in a
folder. A message box then pops up warning about the dangers of hyperlinks.

However, if the button is pressed and the hyperlink does not match a file, a
message box pops up saying Program Does Not Exist.

All of this works just fine EXCEPT that if the user clicks on the original
command button, then on the "Hyperlink Warning" message box clicks cancel, my
message box still pops up saying Program Does Not Exist. Does anyone know
how I can keep this from happening. Thank you :)
 
O

Ofer Cohen

In the code you can check if the file exist before running it

If Dir(stDocName)="" Then
MsgBox "File doesnt exist"
Else
Application.FollowHyperlink stDocName
End If
 
M

Mr. Smiley

May God bless you Ofer! It worked :)

Ofer Cohen said:
In the code you can check if the file exist before running it

If Dir(stDocName)="" Then
MsgBox "File doesnt exist"
Else
Application.FollowHyperlink stDocName
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