Simple Code not working for me

jeffreylewis

New member
Local time
Today, 02:35
Joined
Sep 17, 2020
Messages
15
Hi Guys

Can anoyone see what is wrong with this code?
Its showing the message box every time even on the good urls and does not Exit Sub as required
Thanks

Private Sub CmdView_Click()
On Error GoTo ErrorHandler
Application.FollowHyperlink txtUrl
ErrorHandler:
MsgBox "Dodgy Url Link on Target site", vbCritical, "Oops!"
Me.txtUrl.SetFocus
DoCmd.RunCommand acCmdCopy
Exit Sub
End Sub
 
You are just falling through the code. :(

WALK YOUR CODE TO SEE WHAT IT DOES, not what you think it does.
 
Exit sub needs to be before errorhandler. If not the code will always enter it.
 

Users who are viewing this thread

Back
Top Bottom