Pages

Showing posts with label Show the folder picker dialog box and save the path of folder. Show all posts
Showing posts with label Show the folder picker dialog box and save the path of folder. Show all posts

Saturday, January 7, 2012

Show the folder picker dialog box and save the path of folder

If you want open the folder picker dialog box and then save the path of the folder for further use.

Here is the code-


Sub show_folder_picker()
'tools->refrence-> micrososft office object library
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Choose the folder"
.InitialFileName = "c:\"
.Show
End With
On Error Resume Next
fldpath = Application.FileDialog(msoFileDialogFolderPicker).SelectedItems(1) & "\"
If fldpath = False Then
MsgBox "Folder Not Selected"
Else
MsgBox fldpath
End If
End Sub