Open a PDF in Acrobat Reader using VB?

Solved
YAYA -  
 loulou -
Bonjour, je suis là pour traduire votre texte. Voici la traduction : Hello, I would like to get a little help...
So, I would like to launch Acrobat Reader in VB to automatically open a PDF document. I tried using the Shell function, but it only works to execute .exe files.
So a big thank you to anyone who can help me.
If I wasn't clear enough, just let me know!

6 answers

kevinou55 Posted messages 15 Status Member 2
 
Hello,
it might be a bit late but it could help others,
in the Shell I didn't put a "+" just a space maybe that's where your mistake comes from...
2
Colin
 
It must be done:
Shell "C:\...\adobe.exe + C:\...\monfichier.pdf"
1
YAYA
 
Thank you very much, I will try it on occasion.
0
goodman
 
slt colin

please I'm compiling the following code but only the reader.exe opens; however, my PDF document does not open. Can you tell me where the problem is in my code?

the code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Integer, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer



Private Sub Command1_Click()
Dim ret As Long
ret = Shell("C:\Program Files\Adobe\Acrobat 4.0\Reader\AcroRd32.exe + C:\best practise IT VF rev1.pdf")
End Sub


thank you in advance
0
Einstein17 Posted messages 5 Status Member 5
 
You can use ShellExecute:

The declaration, in a Module:

Public 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 


The usage:

ShellExecute 0&, vbNullString, &ActiveWorkbook.Path & "\test.pdf", MyParameter, vbNullString, vbNormalFocus 

@+
1
nicolascap
 
Bonjour,

cette fonction marche à merveille sur mon appli mais comment prendre en compte le fait que les utilisateurs peuvent avoir des versions d'Adobe Reader différentes et donc des chemins d'accès eux aussi différents dans la fonction Shell.

En gros, quelle fonction logique me permettra d'essayer le premier chemin et si cela ne fonctionne pas, le second ?

Voici mon code pour cette fonction :

Private Sub Groupe49_QuandClic()
'Bouton
Shell "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.EXE " & ActiveWorkbook.Path & "\test.pdf", vbNormalFocus
End Sub

Et je voudrais qu'il donne aussi en seconde possibilité d'activer la fonction shell suivante:
Shell "C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.EXE " & ActiveWorkbook.Path & "\test.pdf", vbNormalFocus

Merci de votre aide !
0
imane
 
Pour ouvrir un fichier PDF, vous pouvez utiliser un lecteur PDF comme Adobe Acrobat Reader, qui est gratuit et facile à utiliser. Vous pouvez également essayer d'autres options comme Foxit Reader ou même ouvrir le fichier dans un navigateur web comme Google Chrome ou Microsoft Edge. Si vous avez besoin d'aide pour installer un de ces logiciels, n'hésitez pas à demander.
0
loulou
 
I couldn't open my PDF files
I went to the control panel, add and remove programs, Acrobat Reader, modify, and repair, the program was reinstalled and everything works.
0
claude b
 
I would like to open a PDF to fax my documents, thank you.
0