How to Retrieve the Pathname of FileID: Q59774
|
The DIRECTORY() command can be used in a Microsoft Excel macro to
retrieve the drive/directory pathname of the current directory.
In Microsoft Excel, any time the directory is changed from any source,
the directory pointer will be changed to reflect the last drive and/or
directory selected. The directory pointer is changed even if you
choose Cancel (press ESC) in the dialog box (custom or built-in).
Note: The DIRECTORY() command returns only the most recent drive and
directory selected, so that a progression through various directories
cannot be followed, nor can multiple directories be selected unless
you choose OK (press ENTER) between selections and the macro calls the
dialog box for each new directory to be selected.
In a Microsoft Excel macro, the DIRECTORY() command can be used after
the DIALOG.BOX() command to retrieve the current directory that has
been changed by a custom dialog box.
Example:
=DIALOG.BOX(dialog_ref)<BR/>
=DIRECTORY()
Another technique, useful when you open files, is to use the
GET.DOCUMENT(2) command, which returns the directory of the active
document. After an OPEN() operation, the active document is the
document just opened, so that GET.DOCUMENT(2) returns the active
drive/directory.
Additional query words:
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: July 23, 1999