Hallo zusammen,
ich habe einen Quellcode, der die Attachments in einem Doc löschen soll, wenn diese zu groß sind.
Das funktioniert eigentlich auch, nur das im Dokument das Bildchen des Attachments überbleibt.
Hier mal der Code:
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim emb As NotesEmbeddedObject
Dim rtitem As NotesRichTextItem
Dim fileSizeKB As Long
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
eval = Evaluate("@AttachmentLengths", doc)
fileSizeKB=Clng(eval(0))/1024
If fileSizeKB >150 Then
Msgbox "The article picture is too big. Please notice that the file may not be greater than 150 kbyte!",16,"Error file size: "+Cstr(fileSizeKB)+" kbyte"
'Delete Attachment
Set rtitem = doc.GetFirstItem( "Image" )
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
Call o.Remove
Call doc.Save( True, True )
End If
End Forall
End If
End If
Alles anzeigen
Was mache ich denn falsch?
Schonmal vielen Dank.
Gruß Stony