The following script keeps giving this error message:
“Function Requires a valid ADT argument”
Any help would greatly be appreciated!!
Sub Initialize
On Error Goto processError
Dim dbdir As New NotesDbDirectory("")
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim newdoc As NotesDocument
Dim session As New NotesSession
Dim view As NotesView
Dim data As NotesDatabase
Dim attachNames As Variant
Dim attachLengths As Variant
Dim attachNumber As Variant
Dim y As Integer
Dim x As Integer
Dim item As NotesItem
Set db = dbdir.GetFirstDatabase(DATABASE)
Print db.Title
count = 0
While Not (db Is Nothing)
Call db.Open("", "")
Print db.title
If (Instr(1,db.FilePath,"Mail\") > 0) Then
Set data = session.CurrentDatabase
Set dc = db.AllDocuments
Print db.Title
REM Messagebox db.Title
Set view = db.GetView("($All)")
If Not(view Is Nothing) Then
REM Messagebox db.FilePath + " " + "view name 1 = " + view.Name
Set doc = view.GetFirstDocument
REM If Not(doc Is Nothing) Then
REM Messagebox db.Title + " " + "First document" + doc.LastAccessed
REM End If
count = 1
attach=0
While Not(doc Is Nothing)
Restart:
Set newdoc = New NotesDocument(data)
count=count+1
attachNumber = Evaluate("@Attachments",doc)
attachNames = Evaluate ("@AttachmentNames", doc)
attachLengths = Evaluate("@AttachmentLengths",doc)
x = Isnumeric(attachNumber) - 1
REM If Str$(x) <> "0" Then Messagebox "x = "+ Str$(x)
If attachLengths(0) <> "" Then
attach=attach+1
REM Print db.Title +" “+Str$(dc.Count)+”/“+Str$(count)+”/"+Str$(attach)
For y = 0 To Ubound(attachNames)
REM Messagebox db.Title + " attachment names"+"("+Str$(y)+") = " + attachNames(y) +":" + Str$(attachLengths(y))
newdoc.AttachmentName=attachNames(y)
newdoc.AttachmentSize=attachLengths(y)
newdoc.AttCreateDate=doc.Created
Set item = doc.GetFirstItem("From")
newdoc.Owner = db.Title
newdoc.Sender = item.Text
Next y
Call newdoc.Save(True, False)
End If
REM Messagebox db.Title + " Not First " + doc.LastAccessed +" count = " + Str$(count)
Set doc = view.GetNextDocument(doc)
Wend
End If
End If
Set db = dbdir.GetNextDatabase
Wend
Exit Sub
processError:
Set doc = view.GetNextDocument(doc)
Resume Restart
Exit Sub
End Sub