OpenFilename$ (function)

Syntax OpenFilename$ [([title$ [,extensions$]])]
Description Displays a dialog box that prompts the user to select from a list of files, returning the full pathname of the file the user selects or a zero-length string if the user selects Cancel.
Comments This function displays the standard file open dialog box, which allows the user to select a file. It takes the following parameters:
Parameter Description
Title$ String specifying the title that appears in the dialog box's title bar. If this parameter is omitted, then "Open" is used.
Extension$ String specifying the available file types. If this parameter is omitted, then all files are displayed.
e$ = "All Files:*.BMP,*.WMF;Bitmaps:*.BMP;Metafiles:*.WMF"
f$ = OpenFilename$("Open Picture",e$)
Example This example asks the user for the name of a file, then proceeds to read the first line from that file.
Sub Main
  Dim f As String,s As String
  f$ = OpenFilename$("Open Picture","Text Files:*.TXT")
  If f$ <> "" Then
    Open f$ For Input As #1
    Line Input #1,s$
    Close #1
    MsgBox "First line from " & f$ & " is " & s$
  End If
End Sub
See Also MsgBox (statement); AskBox$ (function); AskPassword$ (function); InputBox, InputBox$ (functions); SaveFilename$ (function); SelectBox (function); AnswerBox (function).
Notes The extensions$ parameter must be in the following format:
 type:ext[,ext][;type:ext[,ext]]...
Placeholder Description
type Specifies the name of the grouping of files, such as All Files .
ext Specifies a valid file extension, such as *.BAT or *.?F? .
For example, the following are valid extensions$ specifications:
  "All Files:*.*"
  "Documents:*.TXT,*.DOC"
  "All Files:*.*;Documents:*.TXT,*.DOC"