presuming_ed
Registered User.
- Local time
- Today, 22:55
- Joined
- May 6, 2003
- Messages
- 23
I'm running the following code to send an email via Lotus notes. I'm specifying which email account to send it from which works fine. The problem I've got is when I'm attempting to attach a file to the mail I get the message 'Run time error 438. Object doesn't support this property or method. Any ideas? This is the code I'm running.... The problem is on the Set ATTACHME line.
Thanks.
'Set up the objects required for Automation into lotus notes
Dim Subject As String
Dim Attachment As String
Dim recipient As String
Dim BodyText As String
Dim SaveIt As Boolean
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'The current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim EmailSend As Object
Dim EmailApp As Object
'Start a session to notes
'Set Session = CreateObject("Notes.NotesSession")
Set Session = CreateObject("notes.notesUIWORKSPACE")
'Get the sessions username and then calculate the mail file name.
'You may or may not need this as for MailDBname with some systems you can pass an empty string
MailDbName = "mail\srscallc.nsf"
'Set up the new mail document
Set Maildb = Session.COMPOSEDOCUMENT("cardiff_damal01/SRV/UK/TESCO", MailDbName, "Memo")
Maildb.FIELDSETTEXT "Subject", strSubject
Maildb.FIELDSETTEXT "Body", strBody
Maildb.FIELDSETTEXT "SendTo", strSendTo
'Set up the embedded object and attachment and attach it
Set AttachME = Maildb.CreateRichTextItem("C:\stock_tracker.xls")
Set EmbedObj = AttachME.EmbedObject(1454, "", "C:\stock_tracker.xls")
'Send the document
'MailDoc.Send 0, recipient
Maildb.Send
Maildb.Close
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
Thanks.
'Set up the objects required for Automation into lotus notes
Dim Subject As String
Dim Attachment As String
Dim recipient As String
Dim BodyText As String
Dim SaveIt As Boolean
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'The current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim EmailSend As Object
Dim EmailApp As Object
'Start a session to notes
'Set Session = CreateObject("Notes.NotesSession")
Set Session = CreateObject("notes.notesUIWORKSPACE")
'Get the sessions username and then calculate the mail file name.
'You may or may not need this as for MailDBname with some systems you can pass an empty string
MailDbName = "mail\srscallc.nsf"
'Set up the new mail document
Set Maildb = Session.COMPOSEDOCUMENT("cardiff_damal01/SRV/UK/TESCO", MailDbName, "Memo")
Maildb.FIELDSETTEXT "Subject", strSubject
Maildb.FIELDSETTEXT "Body", strBody
Maildb.FIELDSETTEXT "SendTo", strSendTo
'Set up the embedded object and attachment and attach it
Set AttachME = Maildb.CreateRichTextItem("C:\stock_tracker.xls")
Set EmbedObj = AttachME.EmbedObject(1454, "", "C:\stock_tracker.xls")
'Send the document
'MailDoc.Send 0, recipient
Maildb.Send
Maildb.Close
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing