我想使用Windows资源管理器在VBA中查看所选文件的名称或路径。
这是我到目前为止所做的,它打开资源管理器并允许选择文件,但缺少显示文件的名称/路径。
Private Sub CommandButton1_Click()
Dim fd As Office.FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.AllowMultiSelect = True
.Title = "Please select the file."
.Filters.Clear
.Filters.Add "All Files", "*.*"
If .Show = True Then
///
///here comes the part with showing the names in ListBox
///
End If
End With
End Sub
答案 0 :(得分:0)
以下是完成的代码:
["dataA", "dataB", "dataC", "dataD"]