Send Excel attachment via Lotus Notes

  • Thread starter Thread starter simon.q.rice
  • Start date Start date
S

simon.q.rice

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 = "(e-mail address removed)"
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 = "(e-mail address removed)"
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
 
Sorry to jump on this, however I had the same problem which this has helped
100 fold, however is there a way not to send the email as I want to allow the
user to type text in the email first.
 
Back
Top