how can i use below lotusscript code in formula.I want to use formula to remove existing attachment.
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim col As NotesDocumentCollection
Dim item As NotesItem
Set db = session.CurrentDatabase
Set col = db. UnprocessedDocuments
If col Is Nothing Then
Msgbox "none docs selected"
Exit Sub
End If
Set doc = col.Getfirstdocument
While Not (doc Is Nothing)
Set item = doc.GetFirstItem( "PDAttach" )
If doc.hasitem("PDAttach") Then
Call item.Remove
End If
Call doc.Save(True, True)
Set doc = col.Getnextdocument(doc)
Wend