I have the following email agent run to detect documents which are not complete in a database.Right now i am getting Object varible not set in the line i have documented below. Any help with error would be greatly appreciated.
Thanks,
adam
Sub Initialized
Dim workspace As NotesUIWorkspace
Dim session As NotesSession
Dim uidoc As NotesUIDocument
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim docMemo As NotesDocument
Dim bodyfield As NotesRichTextItem
Dim style As NotesRichTextStyle
Set workspace = New NotesUIWorkspace
Set session = New NotesSession
Set uidoc = workspace.CurrentDocument
Set db = session.CurrentDatabase
------> Set doc = uidoc.Document <------------
Set docMemo = New NotesDocument(db)
Set bodyfield = New NotesRichTextItem(docMemo,"Body")
Set style = session.CreateRichTextStyle
On Error Goto errorhandling
'STPeople(0) = "ecomm group"
'STPeople(1) = "<field rep?>"
docMemo.Form = "Bookmark"
'docMemo.SendTo = STPeople
docMemo.SendTo = "Adam Herringshaw@nycm.com"
docMemo.FlowStatus = "This document has not been completed."
docMemo.Subject = "Audit Alarm"
'Agent Code
style.Bold = True
Call bodyfield.AppendText("Agent Code: ")
style.Bold = False
Call bodyfield.AppendText(doc.agentcode(0))
Call bodyfield.AddNewline(1)
'Agent Name
style.Bold = True
Call bodyfield.AppendText("Agent Name: ")
style.Bold = False
Call bodyfield.AppendText(doc.agentname(0))
Call bodyfield.AddNewline(1)
'Date Requested
style.Bold = True
Call bodyfield.AppendText("Date Requested: ")
style.Bold = False
Call bodyfield.AppendText(doc.datereq1(0))
Call bodyfield.AddNewline(1)
'View DocLink
style.Bold = True
Call bodyfield.AppendText("View the document: ")
style.Bold = False
Call bodyfield.AppendDocLink(doc, "Agent Tracking")
Call bodyfield.AddNewline(1)
Call docMemo.Send(True)
errorhandling: Print "Error: " & Cstr( Err() ) & " " & Error() & " in line: " & Cstr( Erl() )
End Sub