1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Option Explicit
#If Win64 Then 'La machine utilisée tourne en 64 bits
Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
#Else
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
#End If
Private Sub CmdOuv_Click()
Dim chemin, nom, prenom As String
nom = LCase(NomTextBox.Value) 'De même pour prenom
chemin = "C:\BLABLA\" & nom & "_" & prenom & ".pdf"
OuvrirShellExecute (chemin)
End Sub
Public Function OuvrirShellExecute(strFichier)
ShellExecute 0, "open", strFichier, vbNullString, vbNullString, 1
End Function |
Partager