Excel: Using the OPEN.DIALOG and SAVE.DIALOG Functions

ID: Q85911


The information in this article applies to:


SUMMARY

Two Microsoft Excel Add-in file functions, OPEN.DIALOG and SAVE.DIALOG (from FILEFNS.XLA), were inadvertently omitted from the "Microsoft Excel Function Reference." The README.TXT file refers to On-Line Help to learn more about these functions but the reference to these functions in On-Line Help is incorrect. This article contains corrected information about these functions.

In Microsoft Excel version 5.0, there is no separate "Function Reference." The OPEN.DIALOG and SAVE.DIALOG functions are no longer part of the add- ins. For information on these functions, from the Help Menu, choose Contents and then Reference Information. In the General Reference section, choose Microsoft Excel Macro Functions Contents. Now choose the Search button and type OPEN.DIALOG or SAVE.DIALOG to access the information you need.


MORE INFORMATION

OPEN.DIALOG and SAVE.DIALOG are file functions that are made available by loading FILEFNS.XLA from the Library directory, a subdirectory of the Microsoft Excel directory. In Microsoft Excel 4.0 for the Macintosh, these functions are made available by loading the File Functions add-in located in the Macro Library Folder. For more information on loading add-ins, see "Managing Add-in Commands and Functions" in Chapter 4 of the Microsoft Excel User's Guide 2.

OPEN.DIALOG displays the Open dialog box. This is the same dialog box that appears when you choose Open from the File menu. It returns the name of the file that is chosen. The syntax is as follows:

OPEN.DIALOG(file_filter,button_text,title,filter_index)

file_filter: A text string that determines what type of files will be displayed in the dialog box. All files will be displayed if file_filter is omitted. Below is an example of what the file_filter argument might look like to show add-in, text, and Lotus 1-2-3 files:


   text_description1, filter1, text_description2, filter2...

   (for example, "Add-In,*.XLA,Text,*.TXT,Lotus 1-2-3 Files,*.WK?") 


In Microsoft Excel for the Macintosh, the "file_filter" argument is looking for a 4 character file type (as in Type & Creator). An example would be "TEXT" for TeachText documents. A resource editor that returns the file type like RESEDIT could give you this information.

button_text: The button_text argument is ignored under Excel for Windows. In Excel for the Macintosh, this argument is the text you want to appear on the Open Button of the dialog box.

title: In Microsoft Excel for Windows, this argument is a text string for the dialog box title. In Excel for the Macintosh, this argument is ignored.

filter_index: A numeric value representing the starting position in the file_filter list. In the sample file_filter list above, if the filter_index argument was equal to 2, the initial filter would be Text, *.TXT. If the number is outside the correct range for the given file_filter list or is omitted, the initial filter will be the first one in the list. In Excel for the Macintosh, this argument is ignored.

SAVE.DIALOG displays the Save dialog box. This is the same dialog box that appears when you choose Save from the File menu. It returns the filename entered by the user. The arguments for SAVE.DIALOG are the same with one exception. The syntax is as follows:

SAVE.DIALOG(init_filename,title,button_text,file_filter,filter_index)

init_filename: The default file name in the form of text.

Example

=OPEN.DIALOG("Add-In,*.XLA,Text,*.TXT,Lotus 1-2-3 Files,*.WK?",,

   "Custom Open Dialog",2)

=SAVE.DIALOG("newfile.XLA","Custom Open Dialog",,
    "Add-In,*.XLA,Text,*.TXT,Lotus 1-2-3 Files,*.WK?",2) 


REFERENCES

Microsoft Excel version 5.0 On-Line Help
Microsoft Excel version 4.0 README.TXT
Microsoft Excel On-Line Help, version 4.0

Additional query words: 5.0 missing


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: March 24, 1999