Aller à une page spécifique d'un PDF déjà ouvert VBA
Bonjour,
Je souhaite ouvrir un fichier PDF à une page spécifique, le code qui suit fonctionne mais uniquement si le fichier n’est pas déjà ouvert :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Option Explicit
Private Declare PtrSafe Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" _
(ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
Sub OuvrirPdf()
Dim strAcroPath As String, strFichier As String
Dim intPage As Integer
strAcroPath = String(128, 32)
strFichier = C:\Users\antoi\Desktop\Nouveau dossier\Cassation 'A COMPLETER
intPage = 10 'A COMPLETER
If FindExecutable(strFichier, vbNullString, strAcroPath) <= 32 Then
MsgBox "Adobe Acrobat Reader n'a pas été trouvé sur cet ordinateur", vbOKOnly + vbCritical, "Message d'erreur"
Else
strAcroPath = Left$(strAcroPath, InStr(strAcroPath, Chr$(0)) - 1)
Shell strAcroPath & " /a page=" & intPage & " " & strFichier, vbNormalFocus
End If
End Sub |
Avez-vous une idée de code pour le même but mais sur un fichier déjà ouvert ?
Car toutes les solutions que j’ai trouvé sur internet consiste à fermer le fichier déjà ouvert puis le réouvrir.
Si ce n’est pas possible via VBA un script VBS externe me conviendrais.
Merci d’avance pour vos réponses.