By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
but you need to know witch software to call.
This way enables you to print using the native software print function.
This function calls a win32 method : ShellExecute;
it looks in the registry what soft is linked to the file to print.
Hope you'll enjoy this.
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(Byval hwnd As Long, Byval lpszOp As String, _
Byval lpszFile As String, Byval lpszParams As String, _
Byval LpszDir As String, Byval FsShowCmd As Long) As Long
Declare Private Function GetDesktopWindow Lib "user32" () As Long
Private Const SW_HIDE = 0&
Sub PrintAttachment(doc As NotesDocument)
Dim rtItem As NotesRichTextItem
Dim Scr_hDC As Long
Dim ret As Long
Dim file As String
Set rtItem = doc.GetFirstItem("D_Body")
If Not rtItem Is Nothing Then
Forall o In rtItem.EmbeddedObjects
file = ReplaceSubString ( o.Name , " " , "_" )
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,
Null ,"c:\temp" ,SW_HIDE)
If ret <= 32 Then
Msgbox "An error occurs while printing!"