软件开发办公自动化

Notes代理不能自动运行,求大神帮忙看哈

Sub SignMail(title As String,emp As String,sctman As String,doc As NotesDocument,db As NotesDatabase) Dim mailDoc As NotesDocument Set mailDoc = New NotesDocument(db) Dim sender As String Dim st(100) As String Dim ct(2) As String sender = "" Const...显示全部
Sub SignMail(title As String,emp As String,sctman As String,doc As NotesDocument,db As NotesDatabase)

Dim mailDoc As NotesDocument
Set mailDoc = New NotesDocument(db)
Dim sender As String
Dim st(100) As String
Dim ct(2) As String
sender = ""
Const Macro$ = "@Elements(_CurrentAPREmpNo)"
result = Evaluate(Macro$, doc)
For i = 0 To Cint(result(0)) - 1
  st(i) = doc.~_CurrentAPREmpNo(i)
Next i
ct(0) = emp
ct(1) = sctman
mailDoc.Form = "Memo"
mailDoc.SendTo = st
mailDoc.CopyTo = ct
mailDoc.Subject = title
Set RTItem = mailDoc.CreateRichTextItem("Body")
Call RTItem.AddNewLine(1)
Call RTItem.AppendText("Document Link Icon -->")
Call RTItem.AppendDocLink(doc, doc.docno(0))
Call mailDoc.Send(False)
End Sub


Sub Initialize
Dim ws As New NotesUIWorkspace
Dim ns As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument

Dim ncol As Integer
Dim nrow As Integer

Set db=ns.CurrentDatabase
Set view = db.GetView("View-ForSign1")


Dim i As Integer
i = 1

Set doc = view.GetFirstDocument
While Not (doc Is Nothing)
  Call SignMail("【催签通知】E-RunCard System---(" & doc.lotid(0) & ") from(" & doc.EMPNO(0) & " " & doc.EmpEname(0) & ") needs your approval",doc.EMPNO(0),doc.sctman(0),doc,db)
  i = i + 1
  Print "E-runcard test"
  Set doc = view.GetNextDocument(doc)
  
Wend
Call mailformes(i,db)
End Sub


Sub mailformes(i As Integer,db As NotesDatabase)
Dim mailDoc As NotesDocument
Set mailDoc = New NotesDocument(db)
mailDoc.Form = "Memo"
mailDoc.SendTo = "PQMES"
mailDoc.Subject = "E-runcard催签邮件执行情况"
Set RTItem = mailDoc.CreateRichTextItem("Body")
Call RTItem.AddNewLine(1)
Call RTItem.AppendText("今日共发出" & i & "封催签邮件!")
Call mailDoc.Send(False)
End Sub


PS : 手动执行又不报错,调试也没有问题,求大神帮忙看哈哪儿出错了~~~~
自动运行报错如下:
2014-05-27 13:45:33   AMgr: Start executing agent '每天自动催签1' in 'APTPeRuncard.nsf' by Executive '1'
2014-05-27 13:45:33   AMgr: 'ZARA WU/ProQ' is the agent signer of agent '每天自动催签1' in 'APTPeRuncard.nsf'
2014-05-27 13:45:33   AMgr: 'Agent '每天自动催签1' in 'APTPeRuncard.nsf' will run on behalf of 'ZARA WU/ProQ'
2014-05-27 13:45:33   Agent '每天自动催签1' in database 'APTPeRuncard.nsf' signed by 'ZARA WU/ProQ' is running in Full Administrator mode
2014-05-27 13:45:33   AMgr: Agent ('每天自动催签1' in 'APTPeRuncard.nsf') error message: Error creating product object
收起
参与8

查看其它 6 个回答frankyin的回答

frankyinfrankyin项目经理5Y
用以下代码做个异常处理,就知道具体问题了
On Error Goto errp
....
Exit Sub
errp:
        Print "Error " & Err() & ": " & Error() & " ... Error occurred at line " & Erl()
        End
End Sub
基金 · 2014-05-27
浏览1062

回答者

frankyin
项目经理5Y
擅长领域: 服务器系统管理

frankyin 最近回答过的问题

回答状态

  • 发布时间:2014-05-27
  • 关注会员:1 人
  • 回答浏览:1062
  • X社区推广