Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private 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
Sub IMPRIMER_PDF()
Dim FICHIER_A_IMPRIMER As String
Dim x As Long
x = FindWindow("XLMAIN", Application.Caption)
' Le chemin du "FICHIER_A_IMPRIMER" est à adapter:
FICHIER_A_IMPRIMER = "C:\Documents and Settings\MA_POMME\Bureau\MACHIN.pdf"
ShellExecute x, "print", FICHIER_A_IMPRIMER, "", "", 1
End Sub
Sub test()
LongFilename = Application.GetOpenFilename("PDF Files (*.pdf), *.pdf,(*.*),*.*")
fich = CStr(LongFilename)
rep = ShellExecute(0, "open", fich, "", "", 0)
'==================================== Ordre d'impression
ShellExecute x, "print", fich, "", "", 1
' ====================================
SendKeys "%(hi)"
Application.OnTime Now + TimeValue("00:00:03"), "monok"
End Sub
Bonsoir, ou Bonjour à ceux passeront par là.
Est-il possible de provoquer l'impression d'un fichier "PDF"
existant dans un répertoire par une macro?
Si vous avez une solution, ce serait sympa...
Bonne fin de soirée, et de fin de semaine à vous.
Yann