使用Shell對象的的方式獲取選擇的文件夾路徑
Private Sub cmdDir_Click()
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "選擇文件夾", 0, 0)
If Not objFolder Is Nothing Then
txtDir.Text = objFolder.self.Path
Else
Exit Sub
End If
Set objFolder = Nothing
Set objShell = Nothing
End Sub