Private Type OPENFILENAME lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir As String lpstrTitle As String Flags As Long nFileOffset As Integer nFileExtension As Integer lpstrDefExt As String lCustData As Long lpfnHook As Long lpTemplateName As String End Type
Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Function SimpleGetOpenFileName() As String ' Opens the Open dialog with default values.
Dim msaof As OPENFILENAME Dim intRet As Integer Dim strRet As String 'initialize sensible fields of OPENFILENAME With msaof .lStructSize = Len(msaof) .lpstrTitle = "Select Any File" .lpstrFilter = "All Files" & vbNullChar & "*.*" & vbNullChar & vbNullChar .lpstrFile = String$(255, 0) .nMaxFile = 255 End With
intRet = GetOpenFileName(msaof) If intRet Then strRet = msaof.lpstrFile End If
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.