Dim session As New NotesSession Dim dbase As NotesDatabase Dim directory As New NotesDBDirectory("") Dim Status As Long Dim nlog As New NotesLog("Compact Utility") Call nlog.OpenMailLog(session.username,"DB Compact Utility") Set dbase = directory.GetFirstDatabase(Database) Call dbase.Open("",dbase.FileName) On Error Resume Next While Not (dbase Is Nothing) If dbase.PercentUsed < 90 Then status = dbase.Compact If Err = 4005 Then Call nlog.LogAction(dbase.FileName & " is in " _ & "use") Err = 0 Else Call nlog.LogAction("Compacted " & _ dbase.FileName) End If Else Call nlog.LogAction("Database " & dbase.FileName & _ " already " & dbase.PercentUsed & " Percent Used") End If Call dbase.Close() Set dbase = directory.GetNextDatabase() Call dbase.Open("",dbase.filename) Wend Call nlog.close Messagebox ("Finished Compacting") End Sub | ||||||||||||