+ Reply to Thread
Results 1 to 7 of 7

How do I send a notification email?

  1. #1
    Registered User
    Join Date
    01-15-2015
    Location
    US
    MS-Off Ver
    Office 2013
    Posts
    3

    How do I send a notification email?

    Hello Everyone,

    I have a workbook on a network drive that many employees have access to and update. How do I get a notification email sent to me after someone has saved the workbook? I do not know much about VB so I am coming here to the experts to see if you can help me out.

    Thank you.
    Stodd

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How do I send a notification email?

    Hi,

    Unless you have some way of capturing the name of the user then you won't know who has saved the workbook, but the following will tell you that it has been saved. It assumes you use Microsoft Outlook as the email client. If not you'll need to tell us.

    The code goes in the BeforeSave workbook procedure

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    01-15-2015
    Location
    US
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: How do I send a notification email?

    Richard,

    Thank you for the reply. Yes I am using outlook as the email client. This will send an email notification to me when the workbook has been saved? Is there something i need to do to get it to send the email?

    Stodd

  4. #4
    Registered User
    Join Date
    06-04-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How do I send a notification email?

    You can add this to get the name of the user
    Dim Name as String
    Name = Application.userName

    .Subject = "The xxxxx workbook has just been saved"
    .Body = Name + "has just saved the workbook"

  5. #5
    Registered User
    Join Date
    01-15-2015
    Location
    US
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: How do I send a notification email?

    I've tried to paste this code into VB for the workbook, however, I'm not getting any emails yet. Not sure what I am doing wrong.. I hit ALT+F11 to get to VB and on the left side under project - VBAProject i click on the "Thisworkbook" and then i go to "View" menu to view the code. Then under that in the code window I enter the code below for the workbook and beforesave are both selected from the drop downs.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Dim OutApp As Object
    Dim OutMail As Object

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail
    .to = "Ihave my email address inside here"
    .cc = ""
    .BCC = ""
    .Subject = "The xxxxx workbook has just been saved"
    .Body = "email body text if applicable"
    .Send

    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing

    End

    End Sub

  6. #6
    Registered User
    Join Date
    06-04-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How do I send a notification email?

    I copy pasted the code. Here is a screen shot of what mine looks like. It sounds like you are doing everything right.
    Another thing to check is. Are macros disabled on their computers. Because if they are then well it wont run.

    Capture.JPG

  7. #7
    Registered User
    Join Date
    06-04-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How do I send a notification email?

    I copy pasted the code. Here is a screen shot of what mine looks like. It sounds like you are doing everything right.
    Another thing to check is. Are macros disabled on their computers. Because if they are then well it wont run.

    Attachment 374766

+ 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. Auto Save-as & Send Email Notification
    By Nerdy Nurse in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-18-2014, 01:08 PM
  2. Auto send email notification
    By blackdiam0nd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-21-2012, 04:12 AM
  3. How to send email notification from excel
    By amitwaje in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-19-2012, 06:49 AM
  4. Will excel send a notification email?
    By nak1777 in forum Excel General
    Replies: 4
    Last Post: 02-04-2009, 03:19 PM
  5. Send Email Notification Upon Edit
    By novamustangs in forum Excel General
    Replies: 1
    Last Post: 07-18-2007, 09:51 AM

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