Vielleicht hilft das was - habe ich gerade in meiner Grabbelbox gefunden. Das Gedöns mit der Abfrage auf alle möglichen Extensions ist ein bißchen sehr unglücklich geschrieben und läßt sich sicherlich verbessern oder gar ganz weglassen - muß man aber checken, vor allem, wenn für empfangene Attachments mal keine Applikation da ist oder die kein "print" verträgt oder ... Wie gesagt: Was zum Spielen.
HTH,
Bernhard
Printing attachments based on types
by Davis Varghese & Abdul Anwer
Description:
This 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
Code:
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&
Dim ritem As Variant
Dim Scr_hDC As Long
Dim ret As Long
Dim file As String
Sub PrintAttachment(doc As NotesDocument)
Dim ritem As Variant
Dim Scr_hDC As Long
Dim ret As Long
Dim file As String
Set ritem=doc.getfirstitem("Body")
If (ritem.type=RICHTEXT)Then
If Isarray(ritem.embeddedobjects) Then
Forall o In ritem.embeddedobjects
If (o.type=EMBED_ATTACHMENT) Then
Call o.extractfile (o.name)
extname=Right$(o.name,3)
If extname="tml" Or extname="TML" Then
extname=Right$(o.name,4)
End If
varobject = o.object
If extname="DOC" Or extname="doc" Then
file=o.name
Call 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.name
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp"
,SW_HIDE)
End If
if extname="PPT" Or extname="ppt"Then
file=o.name
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp"
,SW_HIDE)
End If
If extname="TXT" Or extname="txt"Then
file=o.name
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp"
,SW_HIDE)
End If
If extname="PDF" Or extname="pdf"Then
file=o.name
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp"
,SW_HIDE)
End If
If extname="HTML" Or extname="html"Then
file=o.name
call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp"
,SW_HIDE)
End If
If extname="TIF" Or extname="tif"Then
file=o.name
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp"
,SW_HIDE)
End If
End If
End Forall
End If
End If
End Sub