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