Send Email If

G

Gee

I have a spreadsheet that feeds from an Access Database.

Only certain records are shown, it refreshes every minute and the column
"TIMER" shows the minute difference between the time the call came in and
NOW().

What I'm trying to do is send and email when a record reaches 15
minutes...like if it's been on the spreadsheet for 15 minutes, an email goes
to a particular address.
I need an "IF" statement to do this.
There are usually 1 to 5 records on the spreadsheet.

I need something like:

If any cell in TIMER column = 15 then send the Range of that record (like
A4:K4) to (e-mail address removed) with "NOC TIMER" in the subject line.

Help?

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

Gee

I looked at those already because I saw them referenced in other "send email
from excel" questions on this forum, I just can't figure out how to the the
"IF" part in there!
Losing my mind in Idaho,
Gee
 
R

ryguy7272

How 'automatic' do you want it to be? Do you want it firing if a user
clicks a button? If so, see below:

Sub modEmail()

If Worksheets("Sheet1").Range("B1") = "Yes" Then

Dim OutApp As Object
Dim OutMail As Object
Dim strto As String, strcc As String, strbcc As String
Dim strsub As String, strbody As String

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

strto = "My E-mail Address"
strcc = ""
strbcc = ""
strsub = "CSU Inventory Gain"
strbody = "This is an automated message."

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

End If


Set OutMail = Nothing
Set OutApp = Nothing

Close Workbook

End Sub

If you want it firing if a value is simple entered into a cell, right-click
the sheet and paste the code into the window that opens:

Private Sub Worksheet_Change(ByVal Target As Range)
'etc., etc.
End Sub

HTH,
Ryan---
 
G

Gee

No button clicking at all, it's got to be totally automatic and
unmonitored...when any cell in Column K (which is the NOC field in Access)
gets to 15, an email fires automatically.
In Access it's:

If NOC = "15" Then
DoCmd.SendObject acSendReport, "NOCR", acFormatSNP, (e-mail address removed), , ,
"NOC AGING", Me.CallNo, False
End If

I don't know how to do that in Excel. I have to have it come from Excel to
solve certain problems.
Thanks,
Gee
 
G

Gee

I just can't figure out how to get this to fire!

It sounds so simple.

If Cell HJ2=15 send an email to (e-mail address removed)

I just can't get it. Everything works fine except I can't get the code
written for that email to fire.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Sending An Email 4
Timer Count 9
Send Email 2
Update ALL records 1
Access Automatically Send a notification email once a record is added 0
Delete duplicates based on time 2
Send Mail If Statement 5
Need a countdown timer 6

Top