Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Michel Pierron
Bonjour Nico; Associé à ton bouton:
Private Declare Function FindExecutable& Lib "shell32.dll" Alias _ "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory$, ByVal lpResult$)
Sub PdfLoad() Dim i As Integer, Buffer As String Const sFile = "C:Mes Documentschapitre6.pdf" If Len(Dir(sFile)) = 0 Then MsgBox "File not found !", 64 Exit Sub End If Buffer = String(260, 32) i = FindExecutable(sFile, vbNullString, Buffer) If i > 32 Then Dim exePath As String exePath = Left(Buffer, InStr(Buffer, Chr(0)) - 1) Shell exePath & " " & sFile, vbNormalFocus Else MsgBox "No association found !" End If End Sub
MP
"Nico Iannizzi" a écrit dans le message de news:4f3801c42c6a$43533aa0$
Bonjour tout le monde,
Comment je peux faire pour ouvrir un fichier .pdf en cliquant sur un bouton? Dois-je passe par une macro et quel serait le code?
Merci de votre aide!
Nico Iannizzi
Bonjour Nico;
Associé à ton bouton:
Private Declare Function FindExecutable& Lib "shell32.dll" Alias _
"FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory$, ByVal lpResult$)
Sub PdfLoad()
Dim i As Integer, Buffer As String
Const sFile = "C:Mes Documentschapitre6.pdf"
If Len(Dir(sFile)) = 0 Then
MsgBox "File not found !", 64
Exit Sub
End If
Buffer = String(260, 32)
i = FindExecutable(sFile, vbNullString, Buffer)
If i > 32 Then
Dim exePath As String
exePath = Left(Buffer, InStr(Buffer, Chr(0)) - 1)
Shell exePath & " " & sFile, vbNormalFocus
Else
MsgBox "No association found !"
End If
End Sub
MP
"Nico Iannizzi" <niannizzi@chd.lu> a écrit dans le message de
news:4f3801c42c6a$43533aa0$a001280a@phx.gbl...
Bonjour tout le monde,
Comment je peux faire pour ouvrir un fichier .pdf en
cliquant sur un bouton?
Dois-je passe par une macro et quel serait le code?
Private Declare Function FindExecutable& Lib "shell32.dll" Alias _ "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory$, ByVal lpResult$)
Sub PdfLoad() Dim i As Integer, Buffer As String Const sFile = "C:Mes Documentschapitre6.pdf" If Len(Dir(sFile)) = 0 Then MsgBox "File not found !", 64 Exit Sub End If Buffer = String(260, 32) i = FindExecutable(sFile, vbNullString, Buffer) If i > 32 Then Dim exePath As String exePath = Left(Buffer, InStr(Buffer, Chr(0)) - 1) Shell exePath & " " & sFile, vbNormalFocus Else MsgBox "No association found !" End If End Sub
MP
"Nico Iannizzi" a écrit dans le message de news:4f3801c42c6a$43533aa0$
Bonjour tout le monde,
Comment je peux faire pour ouvrir un fichier .pdf en cliquant sur un bouton? Dois-je passe par une macro et quel serait le code?