Link opening to UNC path instead of mapped drive

john316swan

Board Regular
Joined
Oct 13, 2016
Messages
66
Office Version
  1. 2019
Platform
  1. Windows
When I double click on the target, the link is opening to the UNC path instead of the mapped location. Can someone let me know how to prevent this? Thank you!

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim activeFolder As String
Dim studentFolder As String
 
activeFolder = "M:\Financial Aid\ELECTRONIC FILES\TRADITIONAL UNDERGRAD\"
Cancel = True
 
If Target.Column = 1 Then
On Error GoTo ErrMsg
studentFolder = activeFolder & Left(Target.Offset(x, 2), 1) & "\" & Target.Offset(x, 2) & ", " & Target.Offset(x, 3) & " " & Right(Target.Offset(x, 0), 5)
ActiveWorkbook.FollowHyperlink Address:=studentFolder, NewWindow:=True 'will open to student folder
End If
Exit Sub
 
ErrMsg:
MsgBox ("Folder not named properly")
End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,215,219
Messages
6,123,678
Members
449,116
Latest member
HypnoFant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top