Printing attachments based on typesThis is to print attachments in rich text fields based on their types and without user intervention.It can print, any no of attachments in a rtf with just one click.For windows based lotus notes 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 LongDeclare Private Function GetDesktopWindow Lib "user32" () As LongPrivate Const SW_HIDE = 0&Dim ritem As VariantDim Scr_hDC As LongDim ret As LongDim file As StringSub PrintAttachment(doc As NotesDocument)Dim ritem As VariantDim Scr_hDC As LongDim ret As LongDim file As StringSet ritem=doc.getfirstitem("Body")If (ritem.type=RICHTEXT)ThenIf Isarray(ritem.embeddedobjects) ThenForall o In ritem.embeddedobjectsIf (o.type=EMBED_ATTACHMENT) Then Call o.extractfile (o.name)extname=Right$(o.name,3)If extname="tml" Or extname="TML" Thenextname=Right$(o.name,4)End Ifvarobject = o.objectIf extname="DOC" Or extname="doc" Then file=o.nameCall o.ExtractFile( "c:\temp\" & file )Scr_hDC = GetDesktopWindow()ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)End If If extname="XLS" Or extname="xls"Then file=o.nameCall o.ExtractFile( "c:\temp\" & file )Scr_hDC = GetDesktopWindow()ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)End Ifif extname="PPT" Or extname="ppt"Then file=o.nameCall o.ExtractFile( "c:\temp\" & file )Scr_hDC = GetDesktopWindow()ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)End IfIf extname="TXT" Or extname="txt"Then file=o.nameCall o.ExtractFile( "c:\temp\" & file )Scr_hDC = GetDesktopWindow()ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)End IfIf extname="PDF" Or extname="pdf"Then file=o.nameCall o.ExtractFile( "c:\temp\" & file )Scr_hDC = GetDesktopWindow()ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)End IfIf extname="HTML" Or extname="html"Then file=o.namecall o.ExtractFile( "c:\temp\" & file )Scr_hDC = GetDesktopWindow()ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)End IfIf extname="TIF" Or extname="tif"Then file=o.nameCall o.ExtractFile( "c:\temp\" & file )Scr_hDC = GetDesktopWindow()ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)End IfEnd If End ForallEnd IfEnd IfEnd Sub