Send embed object causes authorisation failure

Hello, I am writing a VBA script to attempt to send xls files to a set of users and I can create the e-mail without the attachment and it works fine. But when I add the attachment via EmbedObject…I get the error 7000: you are not authorized to perform that action

I’m wondering where I can authorise this. one thing I noticed that the database settings seem different depending where I look at them

in one place its mail\70\t00670.nsf and in another mail\15\t00915.nsf but I don’t think that would be the problem. (Notes replication?)

I’m also wondering if there is another way to attach a document other than embedobject

here is my code.

Public Sub SendNotesMail(Subject As String, Attachment As String, Recipient As String, BodyText As String, SaveIt As Boolean)

Dim Maildb As Object

Dim MailDbName As String  

Dim MailDoc As Object  

Dim AttachME As Object  

Dim Session As Object 

Dim EmbedObj As Object  

Dim BODY As Object 



Set Session = CreateObject("Notes.NotesSession") 

Set Maildb = Session.GETDATABASE("", "") ' MailDbName) 

 If Maildb.ISOPEN = True Then 

      'Already open for mail 

 Else 

     Maildb.OPENMAIL 

 End If 

Set MailDoc = Maildb.CREATEDOCUMENT 

MailDoc.Form = "Memo" 

MailDoc.sendto = Recipient 

MailDoc.Subject = Subject 

Set BODY = MailDoc.CREATERICHTEXTITEM("Body") 

BODY.APPENDTEXT BodyText 

BODY.ADDNEWLINE (2) 

If Attachment <> "" Then 

      Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment)

End If 

MailDoc.SAVEMESSAGEONSEND = SaveIt 

MailDoc.PostedDate = Now()

MailDoc.SEND 0  

'Clean Up 

Set Maildb = Nothing 

Set MailDoc = Nothing 

Set AttachME = Nothing 

Set Session = Nothing 

Set EmbedObj = Nothing 

End Sub

Hope you can all help me out. I need to show the proof of concept in a couple of days.

Thanks,

Sal

Subject: Send embed object causes authorisation failure

Your problem seems to be this line:Set EmbedObj = AttachME.EMBEDOBJECT(1454, “”, Attachment)

You are using AttachME which is declared as an object, but not initialized. What you should do is use:

Set EmbedObj = BODY.EMBEDOBJECT(1454, “”, Attachment)

Since you’re not using EmbedObj, you could just as well do:

Call BODY.EMBEDOBJECT(1454, “”, Attachment)

/Peter