Example

This example opens a dialog box using the default title "Browse for Folder." The Text argument is used to display the text "Use this folder" in the dialog box. The StartInFolder argument is omitted, so the dialog box opens in the current default folder. For this example, the returned value is displayed in a message box.

Sub BrowseForFolder ()

 Dim folder As String

 With Session

  folder = .GetFolderName(, "Use this folder: ")

  MsgBox "User selected " & folder

 End With

End Sub