我有以下代码,但使用它我只能选择文件夹。我还希望能够选择一个 zip 文件(如果不是文件夹)
Function GetFolder() As String
Dim fldr As FileDialog
Dim sItem As String
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
.Title = "Select a file"
.AllowMultiSelect = False
.Filters.Clear
If .Show <> -1 Then GoTo NextCode
sItem = .SelectedItems(1)
End With
GetFile = sItem
Set fldr = Nothing
End Function