# OPENFILENAME Type

    Type OPENFILENAME
      lStructSize As Long
      hwndOwner As Long
      hInstance As Long
      lpstrFilter As String
      lpstrCustomFilter As String
      nMaxCustomFilter As Long
      nFilterIndex As Long
      lpstrFile As String
      nMaxFile As String
      lpstrFileTitle As String
      nMaxFileTitle As String
      lpstrInitialDir As String
      lpstrTitle As String
      flags As Long
      nFileOffset As Long
      nFileExtension As Long
      lpstrDefExt As String
      lCustData As Long
      lpfnHook As Long
      lpTemplateName As String
    End Type

OPENFILENAME-type variables work with the two Windows file dialog box APIs, GetOpenFileName and GetSaveFileName. This type is used both to pass information to the function and returns data from it.

lStructSize
  The size in bytes of the variable (use the Len() function).
hwndOwner
  The handle of the window opening the file dialog box.
hInstance
  ?
lpstrFilter
  The entries in the File Type drop box. The format of the string is "name of file type" & vbNullChar & "mask" & vbNullChar ... for as many types, where name of file type appears in the list and mask is the extension mask. The string must end with a double vbNullChar.
lpstrCustomFilter
  ?
nMaxCustFilter
  ?
nFilterIndex
  What data type of lpstrFilter should be the default.
lpstrFile
  Set it as a series of blank spaces. Receives the complete path and filename of the file(s) the user selects. Multiple filenames are separated by vbNullChar, and the string will end with a double vbNullChar.
nMaxFile
  The length in characters of lpstrFile.
lpstrFileTitle
  Very similar to lpstrFile, but only receives the filename of the selected file. If multiple files are selected, this is not set to any useful data.
nMaxFileTitle
  The length in characters of lpstrFileTitle.
lpstrInitialDir
  The default directory to look in.
lpstTitle
  The text that should appear in the dialog box's title bar.
flags
  Zero or more of the file dialog flags specifying how to create the file dialog box.
nFileOffet
  ?
nFileExtension
  ?
lpstrDefExt
  The default extension of a file (only for the Save dialog box). If a file is chosen with the *.* mask, the file gets this extension. Don't include the period.
lCustData
  ?
lpfnHook
  ?
lpTemplateName
  ?

Used by: GetOpenFileName, GetSaveFileName
Back to the index.