Dunk4Divin
New Member
- Joined
- Aug 21, 2019
- Messages
- 16
- Office Version
- 365
- Platform
- Windows
Hi
I am trying to place a hyperlink into a folder into a cell. The code below works, it looks like a hyperlink, the address when hovered over is correct but it doesn't work. I have code for file hyperlink to file and that works so there is no issue with the cell format or the workbook. So I have hit brick wall in terms of ideas.... anybody who can help please?
Sub SelectFolder()
Dim FldrPicker As FileDialog
Dim myFolder As String, cel As Range
Set cel = Range("H10")
Set FldrPicker = Application.FileDialog(msoFileDialogFolderPicker)
With FldrPicker
.Title = "Select A Target Folder"
.AllowMultiSelect = False
If .Show <> -1 Then Exit Sub 'Check if user clicked cancel button
myFolder = .SelectedItems(1)
End With
cel.Hyperlinks.Add Anchor:=cel, Address:=fPath, TextToDisplay:=myFolder
End Sub
Thanks very much
I am trying to place a hyperlink into a folder into a cell. The code below works, it looks like a hyperlink, the address when hovered over is correct but it doesn't work. I have code for file hyperlink to file and that works so there is no issue with the cell format or the workbook. So I have hit brick wall in terms of ideas.... anybody who can help please?
Sub SelectFolder()
Dim FldrPicker As FileDialog
Dim myFolder As String, cel As Range
Set cel = Range("H10")
Set FldrPicker = Application.FileDialog(msoFileDialogFolderPicker)
With FldrPicker
.Title = "Select A Target Folder"
.AllowMultiSelect = False
If .Show <> -1 Then Exit Sub 'Check if user clicked cancel button
myFolder = .SelectedItems(1)
End With
cel.Hyperlinks.Add Anchor:=cel, Address:=fPath, TextToDisplay:=myFolder
End Sub
Thanks very much