View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Sending 3 email?

Disable the events as below and enable after your code..

Private Sub Worksheet_Calculate()
Application.EnableEvents = False
'your code

'/your code
Application.EnableEvents = True
End If


End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Gee" wrote:

This works!!
I've been working on it forever and finally figured it out, with all of your
help, of course.
The only problem NOW is that it sends 3 emails to the address instead of
just one. I tried changing it to "OnRefresh", "BeforeUpdate", "AfterUpdate",
"OnChange" ect.

What am I missing?

Private Sub Worksheet_Calculate()
If Range("HK2").Value = "YES" Then

Set aOutlook = GetObject(, "Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)
aEmail.Importance = 2
aEmail.Subject = "NOC AGING CALL NUMBER"
aEmail.Body = Range("A2")
aEmail.Recipients.Add "
aEmail.Send

End If

End Sub