+ Reply to Thread
Results 1 to 7 of 7

VBA for automatic email upon cell change via other formula

  1. #1
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Question VBA for automatic email upon cell change via other formula

    Please see attached example. all details there and noted clearly.

    current code:

    Sub emailinstant()

    Dim OutApp As Object
    Dim OutMail As Object
    On Error Resume Next
    Err.Clear
    Set OutApp = GetObject(Class:="Outlook.Application")
    If Err <> 0 Then Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail
    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "TEST"
    .Body = "TEST"
    .Send
    End With

    Set OutMail = Nothing
    Set OutApp = Nothing

    end sub



    thanks
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: VBA for automatic email upon cell change via other formula

    You need to use the sheet's calculate event. Copy this code, right-click the sheet tab, select "View Code" and paste the code into the window that appears. I have assumed that you will have a column of email addresses - in this case, "C", which you can change.
    Please Login or Register  to view this content.
    Then change your existing code to accept the address:

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: VBA for automatic email upon cell change via other formula

    Thank you for your input. I actually don't have a column of email addresses, but I may consider adding out to use this.

    one question, I understand all of that (I think) but what is the (range("F:F") all about

  4. #4
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: VBA for automatic email upon cell change via other formula

    Sorry I forgot I sent a little practise sheet for you to look at. I understand what you meant. I will add the emails to column C and add your script etc and let you know if it solves my problem. thanks

  5. #5
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: VBA for automatic email upon cell change via other formula

    Sorry. your going to have to really dumb down your formula and explain it in lamens terms if you want to help. because I get feeling some of that code im not meant to copy but im being too stupid to realise. lol

  6. #6
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: VBA for automatic email upon cell change via other formula

    error pic below
    Attached Images Attached Images

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: VBA for automatic email upon cell change via other formula

    The sub that I posted needs to be placed in a standard codemodule, which your project does not contain. Use the insert menu, then cut the subroutine out of the sheet's codemodule and paste it in the new module. I incorrectly assumed that you already had code in your workbook - make sure that you save the workbook as a macro-enabled .xlsm file.

+ 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. Automatic email based on excel sheet cell value
    By caf20012 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2014, 05:55 AM
  2. Automatic email notifications based on cell value
    By rmham120 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2013, 10:48 AM
  3. Cell automatic calculation and email function
    By matelot09 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-08-2012, 12:29 AM
  4. Automatic Email from Excel based on Date in Cell
    By cyee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-25-2011, 06:04 AM
  5. [SOLVED] Can I change a cell and cause an automatic change in other cells
    By Swissmiss in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM

Tags for this Thread

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