为什么要再贴一遍代码??Option Explicit
Dim mNotesSession As Domino.NotesSession
Dim mNotesDatabase As Domino.NotesDatabasePublic Sub Initialize(UserName As String, Password As String)
    Call mNotesSession.InitializeUsingNotesUserName(UserName, Password)
End SubPublic Sub OpenDatabase(ServerName As String, DatabaseName As String)
    Set mNotesDatabase = Nothing
    Set mNotesDatabase = mNotesSession.GetDatabase(ServerName, DatabaseName)
End SubPublic Function GetDocumentFieldbyUNID(DocumentID As String, FieldName As String) As String
    Dim tStr As String
    Dim tDoc As Domino.NotesDocument
    Dim tItem As Domino.NotesItem
    Dim i As Long
    
    tStr = ""
    Set tDoc = mNotesDatabase.GetDocumentByUNID(DocumentID)
    If Not tDoc Is Nothing Then
        Set tItem = tDoc.GetFirstItem(FieldName)
        For i = 0 To UBound(tItem.Values)
            tStr = tStr + tItem.Values(i) + "|"
        Next
        If tStr <> "" Then
            tStr = Left(tStr, Len(tStr) - 1)
        End If
    Else
        Err.Raise 1001, , "未找到指定的文档!"
    End If
    
    Set tItem = Nothing
    Set tDoc = Nothing
    GetDocumentFieldbyUNID = tStr
End FunctionPublic Sub SetDocumentFieldbyUNID(DocumentID As String, FieldName As String, Value As String)
    Dim tStr As String
    Dim tDoc As Domino.NotesDocument
    
    Set tDoc = mNotesDatabase.GetDocumentByUNID(DocumentID)
    Call tDoc.ReplaceItemValue(FieldName, Value)
    tDoc.Save True, False
    
    Set tDoc = Nothing
End SubPrivate Sub Class_Initialize()
    Set mNotesSession = New Domino.NotesSession
End SubPrivate Sub Class_Terminate()
    Set mNotesSession = Nothing
    Set mNotesDatabase = Nothing
End Sub