Lotus notes Send Email

Posted on 2010-11-17
Last Modified: 2013-12-18

I have attached a spreadsheet.

I have code to send an email from lotus notes in Module two.

I would like the email to be automatically sent when either of two events happens

(1) IF N68 (CA Checklist) = "Send Email" at 12.00, then Send Email
(2) IF N69 (CA Checklist) = "Send Email" at 18.00, then Send Email

I put some code in Sheet1 (CA Checklist) for the recipitant and subject.

The password for the project is "protectprocess"

Any suggestions would be great!

Question by:Seamus2626
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 46

Expert Comment

by:Sjef Bosman
ID: 34156711
For how to send mails from Excel, see or search Google using
      excel vba send mail "lotus notes"
to get a shipload of suggestions.

Author Comment

ID: 34157297

I have tried to code myself

If you look at the two new subs in  CA Checklist and then Module 3.

Everytime i try to run these nothing happens?

protectprocess is password

LVL 22

Expert Comment

ID: 34157344
As far as I know, you can't schedule code to run in Excel, so sending email at specific times from within the spreadsheet probably won't work.  Most events occur when someone changes something.  For this to work, you just add a function named Worksheet_Change to your worksheet code.  The [Target] parameter tells you what was changed.

    Private Sub Worksheet_Change(ByVal Target As Range)

If you need to send email at specific times, you'll need to use a scheduler to trigger your code, but I don't think you can do this from VBA within the spreadsheet since you'd have to open the spreadsheet in order to trigger the macro.  My suggestion is to switch to a compiled executable which uses COM to do the same thing.  Then call the exe from your scheduler.
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.


Author Comment

ID: 34157473

Hi Bill,

I was thinking the same regarding the time. The worksheet would need to be constantly refreshed.

What is a compiled executable which uses COM?

LVL 22

Expert Comment

ID: 34157478
I looked at your code, and the main problem is where you call Mail_Sheet_Outlook_Body.  When I run the code, I get an exception with this message 'Argument not optional' on that line.

You have Mail_Sheet_Outlook_Body defined in Module3 as...

   Sub Mail_Sheet_Outlook_Body(Total As String, P1 As String, P2 As String, Spec As String, P4 As String, P5 As String, Student As String)

... which means that you need to pass in all parameters when you call it.

Also, you are not comparing times correctly.  Here's how I would write this part of the Worksheet_Change function...
Private Sub Worksheet_Change(ByVal Target As Range)
 If Time < CDate("12:00 PM") Then Exit Sub
 If Intersect(Target, Range("n68")) Is Nothing Then Exit Sub
 If LCase(Target) = "Send Email" Then Call Mail_Sheet_Outlook_Body("Total", "P1", "P2", "Spec", "P4", "P5", "Student")
End Sub

Open in new window

LVL 22

Accepted Solution

Bill-Hanson earned 500 total points
ID: 34157582
RE: "What is a compiled executable which uses COM?"

MS Office exposes the entire VBA API as a COM interface.  This is just fancy talk that means you can code VBA from just about any Windows development environment (like Visual Studio .Net).

Since you're used to VBA, I would create a Visual Basic project and add a COM reference to the "MS Office XX Object Library" where XX is the MS Office API version you have installed on your machine.  Then in your code, you just use the reference to control the application.  This is how most applications interact with other programs under Windows.

Author Closing Comment

ID: 34157631
Thanks Bill,

I think i will leave this task off as it is a little over my head at the moment.

im more advanced excel than vba!!

Thanks Again

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question