Unable to get email notifciation

Closed
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello,

I have placed below noted in my excel. but I am unable to get the email to my ID.

Please help me

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)

Dim answer As String

answer = MsgBox("save", [vbYesNo = vbOKOnly], "Saving Box")

If answer = vbNo Then Cancel = True
If answer = vbYes Then
'open outlook type stuff
Set OutlookApp = CreateObject("Outlook.Application")
Set OlObjects = OutlookApp.GetNamespace("MAPI")
Set newmsg = OutlookApp.CreateItem(olMailItem)
'add recipients
'newmsg.Recipients.Add ("Sudhakar Mahankali")
newmsg.Recipients.Add ("***@***")
'add subject
newmsg.Subject = "Security Checklist updated"
'add body
newmsg.Body = "This is to inform your that, we have updated the Security Checklist accordingly."
newmsg.Display 'display
newmsg.Send 'send message
'give conformation of sent message
MsgBox "insert confirmation box test here", , "title of confirmation box"

End If

'save the document
'Me.Worksheets.Save

End Sub





1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
I assume this is not in your actual code

'newmsg.Recipients.Add ("Sudhakar Mahankali")
newmsg.Recipients.Add ("***@***")
and you have your email id instead of ****
Can you help me with the correct notes?
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
what you meant correct notes ?'
instead of ***@*** you need to have proper email address like someone@somewhere.com