Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Sending an Outlook e-mail due to a condition in a cell

Example for cell A1

The change event will run the code when you change the cell
It must be placed in a sheet module

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
If Target.Value = "Y" Or Target.Value = "True" Then
Mail_with_outlook
End If
End If
End Sub

This sub in a normal module

Change Display to Send if you like it
Don't forget to set a reference to Outlook

How do you that:
1: Go to the VBA editor, Alt -F11
2: ToolsReferences in the Menu bar
3: Place a Checkmark before Microsoft Office Outlook ? Object Library
? is the Excel version number

Sub Mail_with_outlook()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strto As String
Dim strcc As String
Dim strbcc As String
Dim strsub As String
Dim strbody As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)

strto = "
'Or this with the address in a cell
'strto = Sheets("Sheet1").Range("a1").Value
strcc = ""
strbcc = ""
strsub = "Cell A1 is changed"
strbody = "something you want"

With OutMail
.To = strto
.CC = strcc
.BCC = strbcc
.Subject = strsub
.Body = strbody
.Display
End With
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"neil" wrote in message ...
I want to have excel automatically email a specific email
address each time a particular cell equals "Y" or "True".

Any ideas?

Thanks

Niel



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending a Mail from outlook with body coming from excel file PauloD Excel Discussion (Misc queries) 1 November 11th 10 01:59 PM
sending email based on cell condition jbly Excel Discussion (Misc queries) 1 January 4th 08 08:03 PM
Sending One Cell Through Mail from Excel Man Mohan Singh Excel Worksheet Functions 1 April 27th 07 10:56 AM
How to make Microsoft Outlook default e-mail when sending excell . Aimee Excel Discussion (Misc queries) 1 March 4th 05 05:19 PM
sending outlook mail bilal Excel Programming 1 July 25th 03 01:16 PM


All times are GMT +1. The time now is 03:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"