Application.Hyperlink Problem (1 Viewer)

sherlocked

Registered User.
Local time
Today, 03:58
Joined
Sep 22, 2014
Messages
125
Experts,

I have the following code in two different databases:

Code:
Application.FollowHyperlink "\\S:\myfoldername", , True

In one of my databases, this works totally fine. In another, I get the following error message:

Run-time error 490 - Cannot Open The Specified File.

I have already verified that the path is correct in this second instance. I can navigate through manually and the shared folder location I'm looking for exists and the permissions to access it are correct.

Any idea as to why this same function would work in one database and not in another?
 

sherlocked

Registered User.
Local time
Today, 03:58
Joined
Sep 22, 2014
Messages
125
Because I was not getting any responses and feared that I had posted it in the incorrect forum area.
 

isladogs

MVP / VIP
Local time
Today, 11:58
Joined
Jan 14, 2017
Messages
18,219
Give it a chance. Forum users do have other things to do...
You could also have mentioned it was a duplicate or asked mods to move it to another forum
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:58
Joined
May 7, 2009
Messages
19,242
You can try to covert the mapped drive
Code:
Function GetUNC(strMappedDrive As String) As String
    Dim objFso As FileSystemObject
    Set objFso = New FileSystemObject
    Dim strDrive As String
    Dim strShare As String
    'Separated the mapped letter from
    'any following sub-folders
    strDrive = objFso.GetDriveName(strMappedDrive)
    'find the UNC share name from the mapped letter
    strShare = objFso.Drives(strDrive).ShareName
    'The Replace function allows for sub-folders
    'of the mapped drive
    GetUNC = Replace(strMappedDrive, strDrive, strShare)
    Set objFso = Nothing 'Destroy the object
End Function

Then call it:

Application.FollowHyperlink GetUNC("S:\myfoldername")
 

Users who are viewing this thread

Top Bottom