Join
the community
Sign-up
Ask a question Report

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

Satya - Latest answer on Feb 1, 2013 06:42AM
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
Read more 
20 answers
Answer
+20
moins plus
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

stacey - Sep 2, 2010 07:52AM
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
Thankful - Sep 22, 2010 03:22AM
Thanx a lot!
This works like a charm in Office 2010 as well.
readyt0race 1Posts Friday October 26, 2012Registration date October 26, 2012Last seen - Oct 26, 2012 12:57AM
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!
rizvisa1 4230Posts Thursday January 28, 2010Registration date ContributorStatus May 7, 2013Last seen - Dec 1, 2012 10:53AM
@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
cdb2013 - Feb 1, 2013 06:42AM
If you changed the event to open would you use "Workbook_Open" instead?
Answer
+0
moins plus
Run time error '287'
Application -defined or object defined error

Answer
+0
moins plus
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

rizvisa1 4230Posts Thursday January 28, 2010Registration date ContributorStatus May 7, 2013Last seen - Jan 4, 2013 01:53PM
@Ananta
see this
http://www.ozgrid.com/forum/showthread.php?t=49302
Answer
+0
moins plus
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

This document entitled « Auto notify or mail when excel sheet updated. » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.

Not a member yet?

sign-up, it takes less than a minute and it's free!

Members get more answers than anonymous users.

Being a member gives you detailed monitoring of your requests.

Being a member gives you additional options.

Receive our newsletter

health.kioskea.net