Auto notify or mail when excel sheet updated. [Solved/Closed]

Closed
Sudhakar M - Oct 7, 2015 at 09:26 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Oct 7, 2015 at 01:55 PM
Hello,

I have used following VBA, but still I am not getting the solution. Please help

I am unable to change the following field.

answer = MsgBox("This is where you put the text to prompt the user if he wants to save or not" vbYesNo, "here is the title of that box")

What should write in the above sentence.

Regards,
Sudhakar M


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

Dim answer As String

answer = MsgBox("This is where you put the text to prompt the user if he wants to save or not" vbYesNo, "here is the title of that 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 ("Name Here")
newmsg.Recipients.Add ("***@***")
'add subject
newmsg.Subject = "Subject line of auto email here"
'add body
newmsg.Body = "body of auto email here"
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

Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Oct 7, 2015 at 01:55 PM
read the message

answer = MsgBox("This is where you put the text to prompt the user if he wants to save or not", vbYesNo, "here is the title of that box")


"This is where you put the text to prompt the user if he wants to save or not": it says that this is the text/sentence/message your user will see.it should be what you want to say to user

"here is the title of that box" : this is just a title of the box that appears. it can be "" or any thing else you want
0