See this site for example code
Sending mail from Lotus Notes (XL-Dennis)
http://www.excelkb.com/?cNode=1X5M7A
--
Regards Ron de Bruin
http://www.rondebruin.nl
<simon.q.rice@gsk.com> wrote in message news:1155284389.296462.220120@75g2000cwc.googlegroups.com...
>I have a routine which I have used frequently (and obtained from this
> group) to send mail from Excel to Lotus Notes. This works extremely
> well and is shown below:
>
> Sub send2()
>
> Dim s As Object
> Dim db As Object
> Dim doc As Object
> Dim nSession
>
> Set s = CreateObject("Notes.NotesSession")
> Set db = s.GetDatabase(" ", "mail\username.nsf")
> Set doc = db.createdocument()
> doc.form = "Memo"
> doc.sendTo = "simon.q.rice@gsk.com"
> doc.Subject = " Send email to Notes"
> 'doc.body = " This works well"
> Call doc.Send(False)
> Set nSession = Nothing
> End Sub
>
> I now want to adapt this routine to send an Excel file attachment and
> so I have added the following lines to my script:
>
> Sub send2()
>
> Dim s As Object
> Dim db As Object
> Dim doc As Object
> Dim nSession
> Dim eo As Object
> Dim rtf As Object
> Dim attachment As String
>
> Set s = CreateObject("Notes.NotesSession")
> Set db = s.GetDatabase(" ", "mail\username.nsf")
> Set doc = db.createdocument()
> doc.form = "Memo"
> doc.sendTo = "simon.q.rice@gsk.com"
> doc.Subject = " Sending attachments through Notes"
> 'doc.body = " This doesn't work well"
>
> '********************************************************************
> 'these are the new lines
> attachment = "C:\TEMP\FaceID.xls"
> Set rtf = doc.CreateRichTextItem("Attachment")
> Set eo = rtf.EmbedObject(1454, "", attachment, "Attachment")
> '***********************************************************************
> Call doc.Send(False)
> Set nSession = Nothing
> End Sub
>
> Stepping through the script at the line,
> Set eo = rtf.EmbedObject(1454, "", attachment, "Attachment"),
>
> I get a Notes run-time error 7067 message which says "Cannot write or
> create file (file or disk is read-only). Needless to say the file or
> disk is not read-only and I have tried attaching a number of different
> workbooks.
>
> Anybody any ideas what I've done wrong or how I might correct this
> please?
> Thank you in anticipation of your help.
>
> Simon
>
Bookmarks