Ms access get file name selected from FileDialog

This is my code and I want to know how to get the name of the selected file

Dim f As Object Set f = Application.FileDialog(3) f.AllowMultiSelect = True If f.Show Then For i = 1 To f.SelectedItems.Count MsgBox f.SelectedItems(i) Next EndIf 
+6
source share
1 answer

Do you mean this?

 Sub Sample() Dim f As Object Set f = Application.FileDialog(3) f.AllowMultiSelect = True If f.Show Then For i = 1 To f.SelectedItems.Count MsgBox Filename(f.SelectedItems(i)) Next End If End Sub Public Function Filename(ByVal strPath As String) As String If Right$(strPath, 1) <> "\" And Len(strPath) > 0 Then Filename = Filename(Left$(strPath, Len(strPath) - 1)) + Right$(strPath, 1) End If End Function 
+10
source

Source: https://habr.com/ru/post/914515/


All Articles