vba 目录选择方法2
今天又看到一个目录选择的方法,原来excel 2002一上,不需要调api了,
'Browse for a folder, using the Excel 2002 FileDialog
Sub BrowseForFolder()
Dim fdBrowser As FileDialog
'Get the File Dialog object
Set fdBrowser = Application.FileDialog(msoFileDialogFolderPicker)
With fdBrowser
'Initialize it
.Title = "Select Folder"
.InitialFileName = "c:\"
'Display the dialog
If .Show Then
MsgBox "You selected " & .SelectedItems(1)
End If
End With
End Sub
Powered by ScribeFire.