By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
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!"