A collection of file filters. Now let' s explore the FileDialog object model for accessing file dialog boxes. Exploring the FileDialog Object Model To understand the object model for accessing file dialog boxes, Figure 2 provides a graphical representation of the collections and objects in the FileDialog object model, and Table 3 describes the purpose of each of these items in the object model. The FileDialog object model Table 3. FileDialogFilters collection Represents a collection of the types of files that can be selected in a file dialog box.
FileDialogFilter object Represents a single file type that can be selected in a file dialog box.
FileDialogSelectedItems collection Represents a collection of paths to files or a folder that a user has selected in a file dialog box. Now that you know the graphical elements of a file dialog box and how they relate to the FileDialog object model, let's look at an example of how to use file dialog boxes programmatically. In the example, which is available for download , I demonstrate how to program the File Picker and Save As file dialog boxes to concatenate multiple Microsoft Word files into one Word file. The custom BuildFileDialogBox function in this example allows you to customize file dialog box user interface elements, such as the title, the initial path or file name, the initial view, and the caption for the action button, by using just one line of code. This is preferable to iterating through long lists of hard-coded property settings every time you want to customize a file dialog box.