Thursday, 3 November 2016

Create a Folder Browse Dialog in Excel using VBA

In this post we are going to see how to create a Folder Browser Dialog in Excel using VBA, normally there is a common object which is used for savefile, select file, open folder separate based on parameters.

Dim folderPath As String

Sub Browse()
  Dim folderdlg As FileDialog
  Set folderdlg = Application.FileDialog(msoFileDialogFolderPicker)
  folderdlg.AllowMultiSelect = True
  If folderdlg.SelectedItems.Count > 0 Then
    folderPath = folderdlg.SelectedItems(1)
  End If
End Sub

When click on the Excel Files Folder , it will launch the folder browse dialog.

From the above code you can learn how to browse a folder using VBA in EXCEL

1 comment: