PSSMargaret
Registered User.
- Local time
- Today, 14:01
- Joined
- Jul 23, 2016
- Messages
- 74
I found the below code at http://stackoverflow.com/questions/14915179/ms-access-browse-for-file-and-get-file-name-and-path. and it works except if a folder or file name has an "#" in the name it won't enter the full path and file name in the textbox. Any idea how to alter this so it enters the entire path to a file no matter what is in the file path or name?
Code:
Private Sub Command7_Click()
Dim f As Object
Dim strFile As String
Dim strFolder As String
Dim varItem As Variant
Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
If f.Show Then
For Each varItem In f.SelectedItems
strFile = Dir(varItem)
strFolder = Left(varItem, Len(varItem) - Len(strFile))
MsgBox "Folder: " & strFolder & vbCrLf & _
"File: " & strFile
Next
End If
Set f = Nothing
End Sub