1- قم بعمل موديول واكتب الكود التالي :
Public Const SW_SHOWMINNOACTIVE = 7
Public 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
2- اعمل زر طباعة وفي حدث عن النقر اكتب الكود التالي:
Dim lngRetVal As Variant
Dim strFolder As String
'****************** USER DEFINED ******************
Const conFilePath As String = "C:\Test\Test.pdf"
'**************************************************
'Extract the Working Folder
strFolder = Left$(conFilePath, InStrRev(conFilePath, "\") - 1)
lngRetVal = ShellExecute(0, "Print", conFilePath, "", strFolder,SW_SHOWMINNOACTIVE)
3- قم بتغيير مسار الملف حسب ماموجود عندك