# BrowseAndOpenFile
{: .no_toc }

Displays a file-open dialog and returns a **FileProperties** collection for the file the user selects.

Syntax: *object*.**BrowseAndOpenFile** [ (*WriteSupport*) ]

*object*
: *required* An object expression that evaluates to a **FilePropertyExplorer** object. The predeclared default instance is available as `FilePropertyExplorer`.

*WriteSupport*
: *optional* A **Boolean** that controls whether the returned **FileProperties** collection is opened with write support for property values. **False** (default) opens it without write support. Pass **True** to allow setting [**FileProperty.Value**](/tB/Packages/Contributed/FileProps/FileProperty/Value.md). Write support requires Windows Vista or newer.

**BrowseAndOpenFile** opens a file dialog for the user to select a file, and returns a [**FileProperties**](/tB/Packages/Contributed/FileProps/FileProperties/index.md) collection for the selected file, as [**OpenFile**](/tB/Packages/Contributed/FileProps/FilePropertyExplorer/OpenFile.md) does for a path. The returned collection contains the [**FileProperty**](/tB/Packages/Contributed/FileProps/FileProperty/index.md) entries for the properties the operating system exposes for the selected file. The notes and the warning on [**OpenFile**](/tB/Packages/Contributed/FileProps/FilePropertyExplorer/OpenFile.md) about write support and about opening a file again apply to the collection this function returns.

### Example

This example uses **BrowseAndOpenFile** to let the user pick a file and then prints all its shell properties to the Debug console.

```tb check_build
Dim Props As FileProperties
Set Props = FilePropertyExplorer.BrowseAndOpenFile()

If Props Is Nothing Then
    Debug.Print "No file selected."
Else
    Debug.Print "File: " & Props.FilePath
    Dim i As Long
    For i = 0 To Props.Count - 1
        Dim Prop As FileProperty
        Set Prop = Props.Item(i)
        Debug.Print Prop.NameDesc & " = " & Prop.ValueDesc
    Next i
End If
```

### See Also

- [FilePropertyExplorer](/tB/Packages/Contributed/FileProps/FilePropertyExplorer/index.md) class -- the predeclared factory class
- [OpenFile](/tB/Packages/Contributed/FileProps/FilePropertyExplorer/OpenFile.md) function -- opens a file by path and returns a **FileProperties** collection
- [FileProperties](/tB/Packages/Contributed/FileProps/FileProperties/index.md) class -- the collection returned by this function
- [FileProperty](/tB/Packages/Contributed/FileProps/FileProperty/index.md) class -- one shell property in the collection
