Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2011
    Posts
    2

    Question Unanswered: Excel VBA Error message interacting with LotusNotes

    Hi Guys,

    I have a long macro that takes inputs from a worksheet and sends out multiple emails. Up to 11 sometimes. Here's the weird part, it sends out some emails, sometimes all, sometimes half. Random.

    The error message is

    RUN-TIME ERROR '7000'
    NOTES ERRORATABASE ALREADY CONTAINS A DOCUMENT WITH THIS ID
    (UNID)

    Here is the section that sends the email, which the same code is repeated a few times.

    Code:
    Sub SendOmnibusEmail()
    
    Dim oSess As Object
    Dim oDB As Object
    Dim oDoc As Object
    Dim oItem As Object
    Dim direct As Object
    Dim Var As Variant
    Dim flag As Boolean
    Dim sSetWbName As String
    
    
    
                                              Set oSess = CreateObject("Notes.NotesSession")
                                              Set oDB = oSess.GETDATABASE("", "")
                                              Call oDB.OPENMAIL
                                              flag = True
                                              If Not (oDB.IsOpen) Then flag = oDB.Open("", "")
                                              
                                              If Not flag Then
                                              MsgBox "Can't open mail file: " & oDB.SERVER & " " & oDB.FILEPATH
                                              GoTo exit_SendAttachment
                                              End If
                                             
                                            
                                              ' EMAIL ADDRESS FILES ARE SENT TO  *************************************************
                                              'Building Message
                                              Set oDoc = oDB.CREATEDOCUMENT
                                              Set oItem = oDoc.CREATERICHTEXTITEM("BODY")
                                              oDoc.Form = "Memo"
                                              oDoc.Subject = AccountName
                                              oDoc.sendto = email
                                              oDoc.body = OmnibusBody
                                              oDoc.postdate = Date
                                              oDoc.SaveMessageOnSend = True
                                              
                           oDoc.visable = True
                                              
                                              'Sending Message
                                              oDoc.SEND False
    exit_SendAttachment:
                                                  On Error Resume Next
                                                  Set oSess = Nothing
                                                  Set oDB = Nothing
                                                  Set oDoc = Nothing
                                                  Set oItem = Nothing
    
    oDoc.SEND True
    End Sub

    When I goto debug it goes to this line:

    Code:
    oDoc.SEND False
    Any ideas as to the inconsistency??? Driving me nuts...
    is it some variable that is not clearing before it repeates the lotus notes code?

    thanks everyone is advance!!

  2. #2
    Join Date
    Feb 2011
    Posts
    2
    I've been searching in google and someone else had this problem and just wrote this

    "I fixed it myself. I did not have Lotus Domino Objects ticked in my References."

    does this spark any ideas?

  3. #3
    Join Date
    Sep 2008
    Location
    London, UK
    Posts
    511
    I'm amazed it doesn't bug out on this line:
    Code:
    oDoc.visable = True
    I don't have lotus notes, but surely the property is Visible rather than visable?

    "I fixed it myself. I did not have Lotus Domino Objects ticked in my References."
    In the VBE go to Tools > References and add a reference to Lotus Domino Objects.
    I don't see why this would make any difference since you are late binding, but I hope it works for you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •