0
在此先感謝您的幫助!使用VBA無法從Lotus Notes獲取任何信息
我最終試圖根據主題行從特定電子郵件中提取信息。解決這個問題,下面的代碼是一個測試來拉出主題行。然而,它貫穿132個文件,沒有任何一個主題被確定爲空白之外的任何東西。使用相同的Initialize和GetDatabase方法,我成功地通過Lotus Notes發送了電子郵件,所以我不認爲我以某種方式在錯誤的文檔之後。下面的代碼通過Excel寫在VBA有Lotus Notes 8.5
任何人都看到一個原因,我會什麼都沒有,但空白通過Notes數據庫中的所有文檔?
Sub LotusGetView()
Dim Nsess As New NotesSession
Dim Ndb As NotesDatabase
Dim Ndocs As NotesDocumentCollection
Dim Ndoc As NotesDocument, docNext As NotesDocument
Dim c As Long
Dim memSubj As Variant
Nsess.Initialize
Set Ndb = Nsess.GetDatabase("", "names.nsf")
Set Ndocs = Ndb.AllDocuments
c = 1
Set Ndoc = Ndocs.GetFirstDocument
Do Until Ndoc Is Nothing Or c = 1000
Set docNext = Ndocs.GetNextDocument(Ndoc)
memSubj = Ndoc.GetItemValue("Subject")(0)
If memSubj <> "" Then
MsgBox memSubj
End If
Call Ndoc.Remove(True)
Set Ndoc = docNext
c = c + 1
Loop
MsgBox c
End Sub
你是對的,找到了正確的數據庫。感謝您的幫助! –