Sending active workbook using Lotus Notes via excel 2007

micheldun

New Member
Joined
Nov 12, 2012
Messages
7
I found Nate Oliver's code (below) and tried it to send an email, including attaching the active workbook through the workbook using Lotus Notes. It works as advertised, except the workbook doesn't attach. The recipients, subject and body are all fine. I noticed the original post was from 2006, so it is possible some code has been updated for assigning attachments?

Thanks in advance.
Michel
Office 2007

Option Explicit

Sub LotusNotsSendActiveWorkbook()
****'**** Send an e-mail & attachment using Lotus Not(s)
****'**** Original Code by Nate Oliver (NateO)
****'**** Declare Variables for file and macro setup

****Dim UserName As String, MailDbName As String, Recipient As String, attachment1 As String
****Dim Maildb As Object, MailDoc As Object, AttachME As Object, Session As Object
****Dim EmbedObj1 As Object

****With Application
********.ScreenUpdating = False
********.DisplayAlerts = False

******' Open and locate current LOTUS NOTES User
********Set Session = CreateObject("Notes.NotesSession")
************UserName = Session.UserName
********MailDbName = _
************Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
********Set Maildb = Session.GETDATABASE("", MailDbName)
********If Maildb.IsOpen = True Then
********Else
************Maildb.OPENMAIL
********End If
****
******' Create New Mail and Address Title Handlers
********Set MailDoc = Maildb.CreateDocument
****
********MailDoc.Form = "Memo"
********'** Select range of e-mail addresses
********Recipient = Sheets("E-Mail Addresses").Range("A2").Value
********'** Or send to a signle address
********'** Recipient = "yourname@isp.com"
********MailDoc.SendTo = Recipient
********
********'** Subject & Body stored in a**worksheet
********MailDoc.Subject = Sheets("E-Mail Addresses").Range("B2").Value
********MailDoc.Body = Sheets("E-Mail Addresses").Range("C2").Value
********'** These can be entered here manually instead
********'** MailDoc.Subject = "Check this out!"
********'** MailDoc.Body = "Made you look!"
****
****'** Select Workbook to Attach to E-Mail
********MailDoc.SaveMessageOnSend = True
********MsgBox ActiveWorkbook.Name
************attachment1 = ActiveWorkbook.Name
****
********If attachment1 <> "" Then
************On Error Resume Next
****************Set AttachME = MailDoc.CREATERICHTEXTITEM("attachment1")
****************Set EmbedObj1 = AttachME.embedobject(1454, "attachment1", ActiveWorkbook.Name, "")
************On Error Resume Next
********End If
****
********MailDoc.PostedDate = Now()
************On Error GoTo errorhandler1
********MailDoc.Send 0, Recipient
****
********Set Maildb = Nothing
************Set MailDoc = Nothing
****************Set AttachME = Nothing
************Set Session = Nothing
********Set EmbedObj1 = Nothing
****
********.ScreenUpdating = True
********.DisplayAlerts = True
****End With
****
errorhandler1:
****
********Set Maildb = Nothing
************Set MailDoc = Nothing
****************Set AttachME = Nothing
************Set Session = Nothing
********Set EmbedObj1 = Nothing
****
End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,215,299
Messages
6,124,125
Members
449,142
Latest member
championbowler

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top