Public Function SélectionNomFichier(Titre As String, Filtre As String) As String
'KPD-Team 1998
'URL:
http://www.allapi.net/
'E-Mail:
KPDTeam@Allapi.net
On Error Resume Next
Dim OFName As OPENFILENAME
OFName.lStructSize = Len(OFName)
'Set the parent window
OFName.hwndOwner = Forms(0).hWnd
'Set the application's instance
OFName.hInstance = 1 ''Application.hInstance
'Select a filter
OFName.lpstrFilter = Filtre
'create a buffer for the file
OFName.lpstrFile = Space$(254)
'set the maximum length of a returned file
OFName.nMaxFile = 255
'Create a buffer for the file title
OFName.lpstrFileTitle = Space$(254)
'Set the maximum length of a returned file title
OFName.nMaxFileTitle = 255
'Set the initial directory
OFName.lpstrInitialDir = "C:\"
'Set the title
OFName.lpstrTitle = Titre
'No flags
OFName.flags = &H80000 + &H4
'Show the 'Open File'-dialog
If GetOpenFileName(OFName) Then
SélectionNomFichier = Trim$(OFName.lpstrFile)
Else
''MsgBox "Cancel was pressed"
End If
End Function
Partager