Convert lotusscript code to formula for attachment

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

Subject: convert lotusscript code to formula for attachment

Modify your script like this:

While Not (doc Is Nothing)

If doc.hasitem(“PDAttach”) Then

Set item = doc.GetFirstItem( “PDAttach” )

Call item.Remove

Call doc.Save(True, True)

End If

Set doc = col.Getnextdocument(doc)

Wend

it executes less code this way.

Put this script in an agent and then call the agent in the formula language with:

@Command([RunAgent]; agent)

Shawn