Pages

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

No comments:

Post a Comment