If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Excel VBA Error message interacting with LotusNotes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-25-11, 14:43
solarissf solarissf is offline
Registered User
 
Join Date: Feb 2011
Posts: 2
Question 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!!
Reply With Quote
  #2 (permalink)  
Old 02-25-11, 15:02
solarissf solarissf is offline
Registered User
 
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?
Reply With Quote
  #3 (permalink)  
Old 02-25-11, 16:12
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
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?

Quote:
"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.
__________________
Colin

RAD Excel Blog

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On