banging my head! Please HELP ME
Programmable Logic Controller that monitors our tank levels, pH's, on/off of
motors/pumps. What I am trying to accomplish is when the value is either on
or off, >90 or <90 etc... is to send an email out to notify me and other
managers/superintendents that a critical value has been reached. Once that
email has been sent what I would like to do is to delay another email from
going out for 15min or longer so that the operator has time to fix the issues
and after x amount of time checks the value again if it is not fixed the code
runs again and another email is sent out until the issue is resolved
respectively. (24/7 operation). The value that it is looking at is real time
data updated in ms. Any suggestions on how I can accomplish this? the code works but will send email out constantly. So say it takes 10 minutes to get the level >90 then we would have 10 or more emails. There would not be anyone at the system to click any buttons etc... it must run by itself with no user interaction.
Private Sub Value_DataUpdate()
Dim retstatus As Long
Dim vTime As Variant
If Value.GetValue(vTime, retstatus) < 90 Then
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim theNamespace As Outlook.Namespace
Dim myRecipient As Outlook.Recipient
Set objOutlook = New Outlook.Application
Set theNamespace = objOutlook.GetNamespace("MAPI")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
objOutlookMsg.To = "xxxxxx@whatever.com"
objOutlookMsg.Subject = "We have a critical operations alarm!!!
objOutlookMsg.Body = "URGENT SYSTEM ALARM!!!!!!!!!"
objOutlookMsg.Importance = olImportanceHigh
objOutlookMsg.Send
Set myRecipient = Nothing
Set objOutlookMsg = Nothing
'theNamespace.SyncObjects.Item(1).Start
Set theNamespace = Nothing
Set objOutlook = Nothing
End If
End Sub

