Sub Initialize ... ' Code below should be used while looping through a list of databases to check/purge. Call PurgeSent(db, 90, "1") ... Exit Sub Function PurgeSent(db as NotesDatabase, ndays as integer, debugmode As String) as Integer ' this function browses the documents in the Sent folder, deleting those more than 'n' days old. Dim v As NotesView ' sent view Dim numdays As Integer ' number of days in sent before documents should be purged/killed Dim doc As NotesDocument ' current memo being processed Dim nDoc As NotesDocument ' next memo after doc Dim docDate As NotesDateTime ' current doc's last modified date Dim testDate As NotesDateTime ' today - numdays On Error Goto ErrorHandler ' set-up environment numdays = 14 Set db = s.CurrentDatabase Set v = db.GetView("($Sent)") Set testDate = New NotesDateTime(Today) Call testDate.AdjustDay( -1 * numdays ) ' loop through docs Set doc = v.GetFirstDocument() While Not (doc Is Nothing) ' get next doc, as doc will be removed from inbox Set nDoc = v.GetNextDocument(doc) ' check lastmodified date of current doc and compare to today Set docDate = New NotesDateTime("") docDate.LSLocalTime = doc.LastModified If (testDate.TimeDifferenceDouble(docDate)>0) Then ' delete doc If (debugmode = "1") Then ' verbose mode enabled - log each doc deleted Print "Deleting doc, " & doc.Subject(0) & ", id: " & doc.UniversalID & "." End If Call doc.Remove(False) End If SkipNextDoc: ' get next doc Set doc = nDoc Wend Print "Finished " & db.FileName & "." PurgeSent = 1 FExit: Exit Sub ErrorHandler: Print "(PurgeSent) Unexpected Error: " & Error$ & " (" & Cstr(Err) & "), on line: " & Cstr(Erl) PurgeSent = 0 Resume FExit End Function