+ Reply to Thread
Results 1 to 27 of 27

Send me an Email if someone has made a change to my file.

  1. #1
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    546

    Send me an Email if someone has made a change to my file.

    I have a very sensitive file that I would like it to send me an email if someone has opened it or has has made a change to it. Is this possible? and if it is, is it a resource killer?
    I found this code online, can it be modified for workbook?

    Please Login or Register  to view this content.
    Last edited by wherdzik; 04-06-2021 at 11:37 AM.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Send me an Email if someone has made a change to my file.

    .
    Paste this into a Regular Module :

    Please Login or Register  to view this content.
    In the ThisWorkbook module paste this :

    Please Login or Register  to view this content.
    When the workbook is opened, the email will be automatically sent to the address you specify in the macro.

  3. #3
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    546

    Re: Send me an Email if someone has made a change to my file.

    Logit, first of all thank you so much.

    Is it possible to report who logged in, and what changes were made or does that require significant resources for excel to track this?

    Thanks!

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Send me an Email if someone has made a change to my file.

    .
    The following macro should be pasted in the ThisWorkbook module.

    You will need to create a sheet named "Tracker". It can be hidden.
    The macro tracks changes on all sheets in the workbook.

    Please Login or Register  to view this content.
    If you add code to attach the Tracker sheet to the email it will provide all the information you are seeking.
    You could also clear the Tracker sheet after the email is sent ... to keep the workbook size at a minimum.

  5. #5
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    546

    Re: Send me an Email if someone has made a change to my file.

    Logit, thank you again. I will test this out. you rock!

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Send me an Email if someone has made a change to my file.

    You are welcome.

  7. #7
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    546

    Re: Send me an Email if someone has made a change to my file.

    Logit, this works so beautifully so nice! One more annoying question - how do I add code so that it e-mails me, in the body of the email, what user has opened my workbook. I see the application.username but I do not know how to incorporate that in the body.

    Thank you Thank you!

  8. #8
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Send me an Email if someone has made a change to my file.

    .
    Ok .. paste this in a Routine Module :

    Please Login or Register  to view this content.
    NOTE: Don't forget to enter your email address and email subject in the SendLastRec sub as indicated.

    In the TRACKER sheet module, add this macro :

    Please Login or Register  to view this content.
    Test it and let me know.

    Of course, when you are ready to "go live" change the .DISPLAY to .SEND

  9. #9
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Send me an Email if someone has made a change to my file.

    Sorry to be a wet blanket, but a clever and unscrupulous user could disable event handlers then open your workbook, in which case Workbook_Open wouldn't run, and you wouldn't get an e-mail. Event handlers work with relatively honest, relatively ignorant users.

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Send me an Email if someone has made a change to my file.

    WHERDZIK :

    Made a correction to my last post. In the TRACKER sheet module ... disregard the last posted code WORKSHEET_CHANGE.

    Instead, utilize this :

    Please Login or Register  to view this content.
    This should eliminate some problems.

    NOTE: If you believe there would be more than 100 changes to the workbook over time .... we'll need to include code in the large macro that
    would erase any accumulated data in the TRACKER sheet.

  11. #11
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Send me an Email if someone has made a change to my file.

    Quote Originally Posted by hrlngrv View Post
    Sorry to be a wet blanket, but a clever and unscrupulous user could disable event handlers then open your workbook, in which case Workbook_Open wouldn't run, and you wouldn't get an e-mail. Event handlers work with relatively honest, relatively ignorant users.
    Indeed. Simply denying the macro permission to run, then saving the workbook in the xlsx format, then deleting the original xlsm workbook then re-saving the xlsx workbook in the xlsm format will permanently disable the macro - by deleting it - as well as preventing you getting the email saying who opened it to that end...
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  12. #12
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    546

    Re: Send me an Email if someone has made a change to my file.

    Wow! Cool thank you guys so much - I will try this code out.

    Thank you Thank you!

  13. #13
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Send me an Email if someone has made a change to my file.

    .
    You are welcome. Let us know how things go.

  14. #14
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    546

    Re: Send me an Email if someone has made a change to my file.

    Logit, does the code in post #8 replace everything or is this in addition to the code you have provided previously.

  15. #15
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Send me an Email if someone has made a change to my file.

    Yes, Post #8 replaces everything.

    Take note of the replacement code (Post #10).

  16. #16
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Send me an Email if someone has made a change to my file.

    I was just thinking another workbook running a macro calling Application.EnableEvents = False just before opening the OP's workbook.

    For that matter, disabling networking just before opening the workbook would queue but not send such e-mails. Delete those e-mails from the outbox before reenabling networking, and no e-mail gets sent with no macros needed.

  17. #17
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Send me an Email if someone has made a change to my file.

    hrlngrv :

    Using the macro code I have provided to the OP .. what changes would you make to rectify your concerns ?

  18. #18
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Send me an Email if someone has made a change to my file.

    To the people who are being a 'wet blanket' (your words not mine), I reckon I could mount an argument that no matter what 'security' you put in, there would be someone, somewhere that could bypass it.

    There are plenty of documented cases where the most sophisticated security in the world has been bypassed/hacked.

    I don't think the OP is trying to stop international espionage, just trying to reduce the risk of a user inadvertently or even maliciously opening his workbook and changing it?

    That being the case I think Logit has a very 'Legit' response.

  19. #19
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Send me an Email if someone has made a change to my file.

    No-one said Logit's response is not 'Legit'.

    What Harlan and I have pointed out is the unreliability of what the OP is trying to achieve. And it's not just about "the risk of a user inadvertently or even maliciously opening his workbook and changing it". Consistent with post #11, even a novice user who innocently disables the macro because they're cautious about letting macros run in a workbook that doesn't apparently need them, or saves the workbook in the xlsx format, then works on the saved version, will easily defeat the OP's scheme.

    It is impossible to do anything with VBA to overcome such issues. The kind of auditing the OP seeks can only reliably be achieved at the system level.

  20. #20
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Send me an Email if someone has made a change to my file.

    What I read was that the OP wanted 'an email if someone has opened it or has has made a change to it', and that is satisfied by the solution offered.

    I don't see any better solutions offered here.

  21. #21
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Send me an Email if someone has made a change to my file.

    Quote Originally Posted by Croweater View Post
    I don't see any better solutions offered here.
    What you also don't see here is a reliable solution, just one that gives a false sense of security...

  22. #22
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Send me an Email if someone has made a change to my file.

    Like you said, there is no solution that is foolproof from a security perspective and you don't really know what the OP's requirements are, you are just surmising.

    What I see is a solution that does what the OP said he wanted. You have read more into it, but have offered nothing better. End of.

  23. #23
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Send me an Email if someone has made a change to my file.

    Quote Originally Posted by Croweater View Post
    Like you said, there is no solution that is foolproof from a security perspective and you don't really know what the OP's requirements are, you are just surmising.
    I'd have thought the OP's requirements are clear enough:
    Quote Originally Posted by wherdzik View Post
    I have a very sensitive file that I would like it to send me an email if someone has opened it or has has made a change to it.
    What part don't YOU understand? Logit's solution is not a reliable way of achieving that end.

    End of discussion.

  24. #24
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,416

    Re: Send me an Email if someone has made a change to my file.

    Yes - end of discussion, gents, please, as it's going round in circles and adding nothing particularly useful to the thread.

    ANY VBA solution should carry a 'health' warning: cavat lector.
    Last edited by AliGW; 04-11-2021 at 04:06 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  25. #25
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Send me an Email if someone has made a change to my file.

    End of discussion because you said so?

    What don't YOU understand by it's as reliable as anything else that's been offered, it satisfies the OP's requirements as stated, and may even be good enough in his user environment?

    Instead of telling everyone why the solution is no good, come up with something better.

  26. #26
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,416

    Re: Send me an Email if someone has made a change to my file.

    Please don't ignore post #24. No more, please. This is descending into a rather silly tit-for-tat.

    The caveat has been explained - that's it. It's up to the OP now.

  27. #27
    Registered User
    Join Date
    09-02-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    76

    Re: Send me an Email if someone has made a change to my file.

    The solution provided works within the limitations of Excel, but the wet blankets are right to point these out especially as the OP's states that the file is a sensitive one and their level of experience is unknown.
    A further issue might be using Outlook to send the email. User would need to have it and might find the notification emails in their sent items.

    If you wanted to do this in a more robust fashion you'd need to monitor the file from an external process and then perform an action if a change was detected.
    A way would be to periodically check the modified date and then process a copy of the file to check what had been changed, or write an app using the FileSystemWatcher class.
    However this is likely beyond the scope of this forum.

    There are also a lot of utilities that claim to provide something similar online.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Send row data in an email on cell change
    By fenfool in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-02-2015, 11:43 AM
  2. Workflow with signatures (if cell=x then send email, if signed then send email)
    By Kate2811 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2014, 05:37 AM
  3. send email of changes made in excel sheet
    By ptkhisti in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-09-2014, 03:46 PM
  4. Replies: 2
    Last Post: 02-14-2014, 12:03 AM
  5. change event macro to evaluate windows user who initiated the change then send email
    By pmanoloff in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-23-2012, 03:31 PM
  6. Replies: 0
    Last Post: 05-20-2011, 08:55 AM
  7. [SOLVED] I want a mesage sent when a change is made to an excel file
    By charlieking4747 in forum Excel General
    Replies: 1
    Last Post: 01-13-2006, 03:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1