stirlingmw
Board Regular
- Joined
- Feb 18, 2013
- Messages
- 75
Morning All
I am trying different methods of getting links to files into a Listbox. One method is to paste the file address into a Textbox and then transfer that over to the Listbox as a hyperlink (posted on this forum). The next method I want to explore, which I think may be a little cleaner for my Users is trying to Use FileDialog to locate the file and the copy its address to a textbox or Listbox.
When I open "Add Link" Userform I have a "Select File" Command button and a textbox "txtFileLocation". When the Command Button is pressed opens the FileDialog code. currently I am using this code to locate the files i need.
Can I alter this code so that the MsgBox will read
and then when OK is selected the file address is pasted into txtxFileLocation.
Thanks Steve
I am trying different methods of getting links to files into a Listbox. One method is to paste the file address into a Textbox and then transfer that over to the Listbox as a hyperlink (posted on this forum). The next method I want to explore, which I think may be a little cleaner for my Users is trying to Use FileDialog to locate the file and the copy its address to a textbox or Listbox.
When I open "Add Link" Userform I have a "Select File" Command button and a textbox "txtFileLocation". When the Command Button is pressed opens the FileDialog code. currently I am using this code to locate the files i need.
Code:
Sub selectFile()
Dim dialogBox As FileDialog
Set dialogBox = Application.FileDialog(msoFileDialogOpen)
dialogBox.AllowMultiSelect = False
dialogBox.Title = "Select a file"
If dialogBox.Show = -1 Then
MsgBox "You selected: " & dialogBox.SelectedItems(1)
End If
End Sub
Code:
"You Copied: " & dialogBox.SelectedItems(1)
Thanks Steve
Last edited: