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

Access
Access
A family of Microsoft relational database management systems designed for ease of use.
312 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Tom van Stiphout 1,701 Reputation points MVP
    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

  2. Tom van Stiphout 1,701 Reputation points MVP
    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