我在“邮件到达之前”运行 Lotusscript 代理。我需要它来抓取“#”符号之后的主题行中的文本。无论我如何尝试获取主题字段(Evaluate、getFirstItem、getItemValue 等),我总是以错误告终。通常是类型不匹配或未设置对象变量。
下面的代码是我当前的代码,并在第 14 行“类型不匹配”上返回错误 13
Option Public
Option Declare
Sub Initialize
On Error GoTo ErrorHandler
Dim s As New NotesSession
Dim db As NotesDatabase
Dim view As NotesDocumentCollection
Dim doc As NotesDocument
Dim nextdoc As NotesDocument
Dim result As String
Set db = s.CurrentDatabase
Set view = db.Unprocesseddocuments
If Not view Is Nothing Then
Set doc = view.Getfirstdocument()
While Not doc Is Nothing
result = Evaluate ("@Right(Subject;""#"")", doc)
Print result
Set nextDoc = view.GetNextDocument(doc)
Call doc.Remove(True)
Set doc = nextDoc
Wend
End If
Print "End"
Done:
Exit Sub
ErrorHandler:
Select Case Err
Case Else
Print "Error " & CStr(Err) & " in agent on line " & CStr(Erl) & ": " & Error
Resume Done
End Select
End Sub