Share via

Using FollowHyperlink not working

Maxine Nietz 1 Reputation point
2024-04-10T19:26:24.9+00:00

Have this code on a command button on a form. The field PDFName is also on the form. The filepath comes up OK. However, the line "Application.followhyperlink filepath,1,0" gives an error: RunTime Error 490; Cannot open the specified file." PLEASE HELP!!!!

Dim filepath As String

filepath = "C:\Users\nevadamax\OneDrive\Documents\PMPlus" & Me.PDFName

MsgBox filepath

Application.FollowHyperlink filepath, 1, 0

Microsoft 365 and Office | Access | For business | Windows

2 answers

Sort by: Most helpful
  1. Tom van Stiphout 40,201 Reputation points MVP Volunteer Moderator
    2024-04-10T20:59:12.8166667+00:00

    Set a breakpoint, then in the Immediate window:
    ?filepath

    Copy that text and put it in the Run box (WindowKey+R). What happens?

    0 comments No comments

  2. Tom van Stiphout 40,201 Reputation points MVP Volunteer Moderator
    2024-04-10T20:08:44.6733333+00:00

    Set a breakpoint and in the Immediate window:
    ?filepath

    Then copy that string and paste it into the Run box (WindowKey + R). What happens?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.