Creating a hyperlink command button

MichaelWaimauku

Registered User.
Local time
Tomorrow, 10:54
Joined
Dec 6, 2012
Messages
57
I have a hyperlink field and would like the user to click a button which opens a file dialogue box (being defaulted to a folder location on a server) where a file is selected and the hyperlink to that file stored.

Is this possible? How can I do this?
 
I've managed to find some code to get started with:

Code:
Private Sub Command43_Click()
With Application.FileDialog(1) ' msoFileDialogOpen
If .Show Then
Me.[Link to Image] = .SelectedItems(1)
End If
End With
End Sub

This opens the file dialog box and then puts the location into the hypertext field.

1. How can I default the open file dialog box to a specific location to start with?
2. How can I turn the .SelectedItems(1) into hypertext?

Getting closer :-)
 
After searching for a day :banghead:, finally came up with a solution.

Code:
Private Sub Command69_Click()
     With Application.FileDialog(1) ' msoFileDialogOpen
         .InitialFileName = "L:\Bottling\Supplier Issue Logging"
         If .Show = True Then
             Me.[link to image] = "#" & .SelectedItems(1) & "#"
         Else
            MsgBox "You clicked Cancel in the file dialog box."
         End If
     End With
End Sub

All good now
 

Users who are viewing this thread

Back
Top Bottom