Adding File Path to Hyperlink textbox

MHamid

Active Member
Joined
Jan 31, 2013
Messages
472
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello,

I have the below code that will open the insert hyperlink box.
Is there a way to add the file path location once the insert hyperlink box opens?

code:
Code:
Private Sub cmdLink_Click()
'SetFocus to hyperlink field
     Me.txtHyperlink.SetFocus
     
'Run command to edit hyperlink
     DoCmd.RunCommand acCmdEditHyperlink
'SetFocus to Notes field
    Me.Notes.SetFocus
End Sub

Thank you
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hello,

If anyone is interested, I was able to figure this out.

I created the below function:
Code:
Function selectFile()

    Dim fd As FileDialog
    Dim vrtSelectedItem As Variant
    
    
    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    
    With fd
        .InitialFileName = "[B][URL="file://\\namicgdfs\cpna_data_grp\IT"]specific file path[/URL][/B]"
        .AllowMultiSelect = False
        If .Show Then
            selectFile = .SelectedItems(1)
        Else
            End
        End If
    End With
    Set fd = Nothing

End Function

And I updated my cmdLink button to:
Code:
Private Sub cmdLink_Click()

'SetFocus to hyperlink field
     Me.txtHyperlink.SetFocus
     
'Run command to edit hyperlink
     Me.txtHyperlink = selectFile

'SetFocus to Notes field
    Me.Notes.SetFocus

End Sub

I little round about way to get the cmdLink button to open to a specific folder and insert a selected file path into my hyperlink textbox.

If anyone sees a better way, let me know.
However, this works perfectly and the codes are not long.

Thank you
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,596
Members
452,658
Latest member
GStorm

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