As wesimmo above mentions, using the SendMail function MAY require user interaction (Basically clicking an 'Allow' button) depending on some security settings set by your system admin.
An alternative way is to utilise the Outlook object model from VBA.
In Excel, bring up the VBA window by pressing ALT+F11
Click on the Tools menu and then choose References
In the window that appears, tick the box for Microsoft Outlook 14.0 Object Library (version number may vary depending what version of Outlook is installed on your system)
Click OK
In the Project Explorer (at the left of the VBA window by default), double-click on the worksheet where you will be checking if the stock level is
Copy and paste the code below into the Code window
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value <= 30 Then
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = "[email protected]"
.Subject = "STOCK REMINDER"
.Body = "Stock level has reached lower limit. Please re-order"
.Send
End With
Set objMail = Nothing
Set objOL = Nothing
Else
End If
End Sub
Basically, the code above is checking to see if the value in cell A1 <=30 (change A1 as appropriate to where the stock level is on your own sheet) and if so, will send out an email to the address specified on the .To line