可以通过api函数来取得文件夹的位置,再进行删除. Declare Function SHBrowseForFolder Lib "SHELL32.DLL" (lpBrowseInfo As BROWSEINFO) As Long Declare Function SHGetPathFromIDList Lib "SHELL32.DLL" (ByVal pidl As Long, ByVal pszPath As String) As Long Public choice As String Public Type BROWSEINFO hOwner As Long pidlRoot As Long pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type Function GetDirectory(Optional message) As String Dim bInfo As BROWSEINFO Dim path As String Dim r As Long, x As Long, pos As Integer bInfo.pidlRoot = 0 bInfo.lpszTitle = message bInfo.ulFlags = &H1 x = SHBrowseForFolder(bInfo) path = Space$(256) r = SHGetPathFromIDList(ByVal x, ByVal path) If r Then pos = InStr(path, Chr(0)) GetDirectory = Left(path, pos - 1) Else GetDirectory = "" End If End Function 就可以通过GetDirectory来弹出对话框来选择文件夹,再进行删除了. |