Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Gee Gee is offline
external usenet poster
 
Posts: 32
Default Sending An Email

Can someone please tell me why this won't work?
I have a spreadsheet that feeds from an Access database.
It refreshes every minute.
When certain conditions are met, cell G12 changes from "NO" to "YES".
I don't understand why the following code won't work.
The cell CHANGES from NO to YES, but it doesn't trigger the email to be sent.

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("G12").Value = "YES" Then
ActiveWorkbook.Send
Recipients = "
Subject = "NOC AGING" & Format(Date, "dd/mm/yy")
End If

End Sub

Thank you in advance for any help you can give me.
Gee
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gee Gee is offline
external usenet poster
 
Posts: 32
Default Sending An Email

It keeps getting stuck on "ActiveWorkbook.Send"

"Gee" wrote:

Can someone please tell me why this won't work?
I have a spreadsheet that feeds from an Access database.
It refreshes every minute.
When certain conditions are met, cell G12 changes from "NO" to "YES".
I don't understand why the following code won't work.
The cell CHANGES from NO to YES, but it doesn't trigger the email to be sent.

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("G12").Value = "YES" Then
ActiveWorkbook.Send
Recipients = "
Subject = "NOC AGING" & Format(Date, "dd/mm/yy")
End If

End Sub

Thank you in advance for any help you can give me.
Gee

  #3   Report Post  
Posted to microsoft.public.excel.programming
Gee Gee is offline
external usenet poster
 
Posts: 32
Default Sending An Email

I figured it out!

Private Sub Worksheet_Calculate()
If Range("G12").Value = "NO" Then
Range("A2").Select
End If
If Range("G12").Value = "YES" Then
Range("A1").Select
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("G12").Value = "YES" Then
ThisWorkbook.SendMail ", Subject:="AGING"
End If
End Sub


"Gee" wrote:

It keeps getting stuck on "ActiveWorkbook.Send"

"Gee" wrote:

Can someone please tell me why this won't work?
I have a spreadsheet that feeds from an Access database.
It refreshes every minute.
When certain conditions are met, cell G12 changes from "NO" to "YES".
I don't understand why the following code won't work.
The cell CHANGES from NO to YES, but it doesn't trigger the email to be sent.

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("G12").Value = "YES" Then
ActiveWorkbook.Send
Recipients = "
Subject = "NOC AGING" & Format(Date, "dd/mm/yy")
End If

End Sub

Thank you in advance for any help you can give me.
Gee

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Sending An Email

Pay attention to the fact that the event will be triggered every time ANY
cell is changed.
this means that even if cell A1 will be changed, the macro will check for
the value in cell G12.

you may want to change the condition from "If Range("G12").Value..." to "If
Target.Address = "$G$12"..."

this will trigger the event only if the specific cell (G12) will change.

Can someone please tell me why this won't work?
I have a spreadsheet that feeds from an Access database.
It refreshes every minute.
When certain conditions are met, cell G12 changes from "NO" to "YES".
I don't understand why the following code won't work.
The cell CHANGES from NO to YES, but it doesn't trigger the email to
be sent.
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("G12").Value = "YES" Then
ActiveWorkbook.Send
Recipients = "
Subject = "NOC AGING" & Format(Date, "dd/mm/yy")
End If
End Sub

Thank you in advance for any help you can give me. Gee



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Sending An Email

Pay attention to the fact that the event will be triggered every time ANY
cell is changed.
this means that even if cell A1 will be changed, the macro will check for
the value in cell G12.

you may want to change the condition from "If Range("G12").Value..." to "If
Target.Address = "$G$12"..."

this will trigger the event only if the specific cell (G12) will change.

Can someone please tell me why this won't work?
I have a spreadsheet that feeds from an Access database.
It refreshes every minute.
When certain conditions are met, cell G12 changes from "NO" to "YES".
I don't understand why the following code won't work.
The cell CHANGES from NO to YES, but it doesn't trigger the email to
be sent.
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("G12").Value = "YES" Then
ActiveWorkbook.Send
Recipients = "
Subject = "NOC AGING" & Format(Date, "dd/mm/yy")
End If
End Sub

Thank you in advance for any help you can give me. Gee



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 to email different email address based on cell value Duncan Excel Programming 4 August 25th 09 04:07 PM
Macro for Email - Sending to email addresses in cell Brice Excel Programming 2 January 26th 09 07:28 AM
Sending An Email In Excel Programmatically W/O Sending An Object [email protected] Excel Programming 8 December 1st 08 09:35 PM
Sending a Spreadsheet as an Email Attachment vs. Imbedded in Email billbrandi Excel Discussion (Misc queries) 1 April 3rd 08 03:44 AM
email sending Edwin Martinez Excel Programming 2 May 20th 07 11:46 AM


All times are GMT +1. The time now is 09:38 PM.

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

About Us

"It's about Microsoft Excel"