I'm trying to send a message via my own email email using formulas I bought through the site when a cell value reaches 186 or more
but I can't seem to get it to work it keeps telling me can't find project or library.
Ive place the first part of the code in the worksheet ant the second in the standard module
first part
'Place the code below into the worksheet module
Private Sub Worksheet_Calculate()
If Range("e10:e35") > 186 Then Call SendMessage
End Sub
second part
Sub SendMessage()
Dim objOutlook As Outlook.Application -can't find project or library
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("my email.ca")
.Subject = "CellValue > 186"
.Body = "CellValue: " & ActiveSheet.Range("e10:e35")
.Importance = olImportanceHigh
objOutlookRecip.Resolve
.Send
End With
Set objOutlook = Nothing
End Sub
even to print out a message to me at 186 or more would be great
any help would be appreaciated k
but I can't seem to get it to work it keeps telling me can't find project or library.
Ive place the first part of the code in the worksheet ant the second in the standard module
first part
'Place the code below into the worksheet module
Private Sub Worksheet_Calculate()
If Range("e10:e35") > 186 Then Call SendMessage
End Sub
second part
Sub SendMessage()
Dim objOutlook As Outlook.Application -can't find project or library
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("my email.ca")
.Subject = "CellValue > 186"
.Body = "CellValue: " & ActiveSheet.Range("e10:e35")
.Importance = olImportanceHigh
objOutlookRecip.Resolve
.Send
End With
Set objOutlook = Nothing
End Sub
even to print out a message to me at 186 or more would be great
any help would be appreaciated k