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

Report
-
 cdb2013 -
Hello,

We have a Excel which is saved to a network drive and used by multiple users. What I need is when somebody updates the excel sheet or puts any value or comments on the sheet, it will notify me or auto mail me that the excel sheet is updated. I mean instead of going again and agian to check whether somebody changed the sheet or not it will notify or auto mail to me.

Any kind of help appreciated. Whether I need any software or any VB, Macro can solve the purpose.

Thank you,
Satya
System Configuration: Windows XP Internet Explorer 6.0

4 replies

Hi, I just had this problem and poked around until I found a solution, so here I am passing it on to you. This will automatically send an email to any address/addresses whenever the workbook is saved. The only problem I have with it is that if you save it, you get the prompt, and when you close, excel automatically prompts you again. As long as you don't do a redundant save then you won't get a redundant auto email notification :)





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 ("sampleemailaddresshere@email.com")
'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
33
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2942 users have said thank you to us this month

Should this code work as is? I am a first time VBA user and tried to use this code but did not receive a prompt answer message or a confirmation email
Thanx a lot!
This works like a charm in Office 2010 as well.
Posts
1
Registration date
Friday October 26, 2012
Status
Member
Last seen
October 26, 2012

Hi Shark,

I'm glad I stumbled upon this thread after long attempts at trying to close in on my solution. Sorry to dig up this old thread, but can you please tell this n00b in more detail how to enable notification mails when an excel file is updated?

Highly appreciated, Cheers!
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
760
@readyt0race
This is an event "Workbook_BeforeSave" that is defined in "ThisWorkbook" module and is triggered when workbook is saved.. So if you open your excel file, then press ALT + F11 at the same time, you would be opening VB editor. If you press CTRL + R at same time, you would see the project explorer. There you should see that says "ThisWorkbook". You need to use the code there
If you changed the event to open would you use "Workbook_Open" instead?
Run time error '287'
Application -defined or object defined error
I am getting above error from some of the systems on my network
May on that system Outlook is not configured
Can you please suggest necessary code changes for other web mail applications
As most the systems having Thunderbird
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
760
Thanks Sir,
I tried this piece of code it worked on Thunderbird 17.0 version in my network.
The code actually open Compose window
But does not sends the mail.
Is any addition code is required to send the mails
So I think there must one additional line of code after
Call Shell(strMozillaThunderbird , vbNormalFocus)
which does Send functionality