1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
Private Declare Function GetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) _
As Long
'Structure du fichier
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
Sub OuvrirModele()
Call OuvrirUnFichier(0, "Ouvrir", "P:\System\Application Data\Microsoft\Templates\")
End Sub
Function OuvrirUnFichier(Handle As Long, Titre As String, _
Chemin As String) As String
Dim structSave As OPENFILENAME
With structSave
.lStructSize = Len(structSave)
.hWndOwner = Handle
' .nMaxFile = 255
' .lpstrFile = NomFichier & String$(255 - Len(NomFichier), 0)
.lpstrInitialDir = Chemin
.lpstrFilter = "oft Modele Outlook (*.oft)" & Chr$(0) & "*.oft" & Chr$(0) 'Définition du filtre (aucun)
.Flags = &H4 'Option de la boite de dialogue
End With
If (GetOpenFileName(structSave)) Then
OuvrirUnFichier = Mid$(0, 1, InStr(1, 0, vbNullChar) - 1)
End If
End Function |
Partager