Lotus错误 - 您必须提供项目名称

时间:2014-05-23 15:03:17

标签: lotus-notes lotusscript

 Sub Click(Source As Button)
   Dim workspace As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   Dim doc As NotesDocument
   Dim item As NotesItem
   Set uidoc = workspace.CurrentDocument
   Set doc = uidoc.Document
   Set item = doc.GetFirstItem(“FieldName”)
   Call item.AppendToTextList("TextIWantToAppend")
End Sub

调试时,我在getfirstitem上收到错误,但我不知道为什么,因为它是文本字段的正确名称(允许多个值)

2 个答案:

答案 0 :(得分:2)

您需要使用正确的引号:"

所以改为:

Sub Click(Source As Button)
   Dim workspace As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   Dim doc As NotesDocument
   Dim item As NotesItem
   Set uidoc = workspace.CurrentDocument
   Set doc = uidoc.Document
   Set item = doc.GetFirstItem("FieldName")
   Call item.AppendToTextList("TextIWantToAppend")
End Sub

答案 1 :(得分:1)

嗨,您确定该字段不是RichtextItem吗? 也许有帮助

Sub Click(Source As Button)
   Dim workspace As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   Dim doc As NotesDocument
   Dim item As NotesRichTextItem
   Set uidoc = workspace.CurrentDocument
   Set doc = uidoc.Document
   Set item = doc.GetFirstItem("FieldName")
   Call item.AppendToTextList("TextIWantToAppend")
End Sub 

在尝试打开Item之前,请确保已保存NotesUIDocument。