Email trigger
Is there a way to trigger an email if a cell in a worksheet becomes e.g.
negative? |
Email trigger
You can use a Worksheet Change event on the cell to run code to send an
email. Here is info on events and sending mail http://www.cpearson.com/excel/Events.aspx http://www.j-walk.com/ss/excel/tips/tip86.htm As I recall, the email part can be a bit tricky. I've not done much of it so can't give an example. Private Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub SendEmail() 'Example for Outlook Express 'In Excel 2002 I can use around 600-700 characters Dim msg As String, cell As Range Dim Recipient As String, Subj As String, HLink As String Dim Recipientcc As String, Recipientbcc As String Recipient = " 'Defining subject of email Subj = "Your subject" msg = "Your message" HLink = "mailto:" & Recipient HLink = HLink & "?subject=" & Subj HLink = HLink & "&body=" & msg ActiveWorkbook.FollowHyperlink (HLink) Application.Wait (Now + TimeValue("0:00:03")) Application.SendKeys "%s" End Sub I'm not exactly sure what the first 4 lines do, so you probably ought to figure that out before you use this regularly. In addition, I *think* you may need to have Outlook open to run this. -- HTH, Barb Reinhardt "Ash D" wrote: Is there a way to trigger an email if a cell in a worksheet becomes e.g. negative? |
Email trigger
See also
http://www.rondebruin.nl/mail/change.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Barb Reinhardt" wrote in message ... You can use a Worksheet Change event on the cell to run code to send an email. Here is info on events and sending mail http://www.cpearson.com/excel/Events.aspx http://www.j-walk.com/ss/excel/tips/tip86.htm As I recall, the email part can be a bit tricky. I've not done much of it so can't give an example. Private Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub SendEmail() 'Example for Outlook Express 'In Excel 2002 I can use around 600-700 characters Dim msg As String, cell As Range Dim Recipient As String, Subj As String, HLink As String Dim Recipientcc As String, Recipientbcc As String Recipient = " 'Defining subject of email Subj = "Your subject" msg = "Your message" HLink = "mailto:" & Recipient HLink = HLink & "?subject=" & Subj HLink = HLink & "&body=" & msg ActiveWorkbook.FollowHyperlink (HLink) Application.Wait (Now + TimeValue("0:00:03")) Application.SendKeys "%s" End Sub I'm not exactly sure what the first 4 lines do, so you probably ought to figure that out before you use this regularly. In addition, I *think* you may need to have Outlook open to run this. -- HTH, Barb Reinhardt "Ash D" wrote: Is there a way to trigger an email if a cell in a worksheet becomes e.g. negative? |
All times are GMT +1. The time now is 06:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com