ChooseDirectory(), ChooseFolder()

Summary

Gets the path name to an existing directory/folder.

Changes

In Version 6.0/2012, the Show New Folder Button and Show Edit Text options are ignored by Windows versions after XP.

Syntax

dnm = ChooseDirectory(string prompt, array options)

Argument Contents
prompt A string that appears above the directory tree
Option Type Contents
Initial Directory String The directory first displayed by the dialog box
Show Edit Text Boolean "True" (the default) show edit text item where user can type in a folder name, "False" to hide the item
Show New Folder Button Boolean "True" (the default) show a Make new folder button, "False" to hide the button

Returns

A string indicating the path name of the chosen directory/folder.

Notes

  • Can also be called as ChooseFolder().

  • The directory name in the Initial Directory option must include a trailing backslash.

  • To have the former ChooseDirectory() behavior, set the Show Edit Text and Show New Folder Button options to "False."

  • For Windows versions after XP, the Show New Folder Button and Show Edit Text options are no longer relevant and are ignored.

Example

folder_name = ChooseDirectory("Choose a Folder", )

Error Codes

Error Type Meaning
Escape The user clicked Cancel or hit Escape
Error The option is incorrectly specified

See Also

Function Summary
ChooseFile() Gets the name of an existing file using the Windows File Open dialog box
ChooseFileName() Gets the name of a new file using the Windows File Open dialog box
ChooseFiles() Gets the names of one or more existing files using the Windows File Open dialog box
GetDirectoryInfo() Gets a listing of the contents of a directory