FollowHyperlink and cancel request error

O

Opal

In my database I have a command button which has the
following on click:

Private Sub GiftCatalogue_Click()
Application.FollowHyperlink "C\...\Silo Gift Catalogue.ppt", ,
True
End Sub

The powerpoint presentation is password protected so that no
changes can be made to it and when the command button is
clicked the user has the option of opening (with a password),
cancelling or open Read Only.

Users have been instructed to open as read only. However, I was
looking deeper into this and wondered what if the user clicked this
in error and wants to cancel, when I hit the cancel button I get
an error pop-up telling me that "Some files contain viruses.....blah
blah....Would you like to open this file?" OK/Cancel

If I click OK, it opens Powerpoint and then asks me again if
I wish to open, cancel or open Read Only.

If I hit Cancel, however, I get a Run Time error with a message
that 'The Hyperlink cannot be followed to the destination.'

Does anyone have any advice to make this more user friendly?
Should I just add better error handling? Suggestions appreciated.
Thank you.
 
O

Opal

In my database I have a command button which has the
following on click:

Private Sub GiftCatalogue_Click()
    Application.FollowHyperlink "C\...\Silo Gift Catalogue.ppt", ,
True
End Sub

The powerpoint presentation is password protected so that no
changes can be made to it and when the command button is
clicked the user has the option of opening (with a password),
cancelling or open Read Only.

Users have been instructed to open as read only.  However, I was
looking deeper into this and wondered what if the user clicked this
in error and wants to cancel, when I hit the cancel button I get
an error pop-up telling me that "Some files contain viruses.....blah
blah....Would you like to open this file?"  OK/Cancel

If I click OK, it opens Powerpoint and then asks me again if
I wish to open, cancel or open Read Only.

If I hit Cancel, however, I get a Run Time error with a message
that 'The Hyperlink cannot be followed to the destination.'

Does anyone have any advice to make this more user friendly?
Should I just add better error handling?  Suggestions appreciated.
Thank you.

I added better error handling:

Private Sub GiftCatalogue_Click()
On Error GoTo Err_GiftCatalogue_Click

Application.FollowHyperlink "C:\...\Gift Catalogue.ppt", , True

Exit_GiftCatalogue_Click:
Exit Sub

Err_GiftCatalogue_Click:
MsgBox Err.Description
Resume Exit_GiftCatalogue_Click

End Sub

But if anyone else has any better advice, it would be appreciated.
 

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