+ Reply to Thread
Results 1 to 8 of 8

Need help getting excel to send automatic emails based on cell value

  1. #1
    Registered User
    Join Date
    06-11-2014
    Posts
    5

    Question Need help getting excel to send automatic emails based on cell value

    Ticket Spreadsheet.xlsx

    I have looked at various threads and whilst i can find similar solutions none are working

    I want a ticketing system that automatically sends an email containing references to the address in column I when the corresponding cell B is changed to 'IN PROGRESS' then another (different email) when it is changed to resolved.

    I want a MsgBox to appear asking: 'Would you like to email the customer?' Y/N so i can choose not to send the email. i want excel to just directly send the email via the exchange network IF POSSIBLE and not open outlook email; however i would be happy to run it through Outlook if it makes this work.



    So when column B changes to 'IN PROGRESS' an message box appears.

    If Yes is clicked an email is sent:

    Email Subject: Ticket Number [COLUMN A] for [COLUMN J]

    Email Msg: Thanks for returning your [COLUMN J] your ticket number is [COLUMN A] please quote this on all future emails. We aim to resolve this by [COLUMN C + 7 DAYS]. Thank You.


    When column B is changed to 'RESOLVED' then it should send another email out:

    Email Subject: Ticket Number [COLUMN A] for [COLUMN J] - RESOLVED

    Email Msg: Your issue with your [COLUMN J], ticket number [COLUMN A] has now been resolved. Thank You.


    My code is probably miles away from being right:
    Please Login or Register  to view this content.

    Thanks in advance.
    Last edited by Quito; 08-11-2014 at 07:13 AM. Reason: Added SOLVED prefix

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Need help getting excel to send automatic emails based on cell value

    the first code goes in the worksheet project editor area and the second create a module and put that in there...I suppose you can put them both in the worksheet project area...

    NOTE: you need to fill in the FROM email address and the SMTP server name....

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Registered User
    Join Date
    06-11-2014
    Posts
    5

    Re: Need help getting excel to send automatic emails based on cell value

    Wow – I am certainly A LOT closer – it is coming up with:


    Run-time error ‘-2147220977 (8004020f)’:
    The server rejected one or more recipient addresses. The server response was: 554
    Client host rejected: Access denied


    Do I not need an email account password somewhere in here?

    (PS – ERNEST THANK YOU SO SO MUCH FOR THIS CODE)

  4. #4
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Need help getting excel to send automatic emails based on cell value

    the recipient address means it's not a valid email address.....this does assume (sorry about that) that you are using a local email SMTP Server and a valid user on the that SMTP Server....you don't need a password because I assumed you where logged on as that user....the SMTP system should figure that out....mine does anyways....

    So, Are you logging on as the user that is sending the email?

  5. #5
    Registered User
    Join Date
    06-11-2014
    Posts
    5

    Re: Need help getting excel to send automatic emails based on cell value

    No the emails are coming from a generic returns@ email address so it's remote accessed

  6. #6
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Need help getting excel to send automatic emails based on cell value

    add these two lines in the SendEmail module toward the bottom with the other objmessage stuff

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-11-2014
    Posts
    5

    Re: Need help getting excel to send automatic emails based on cell value

    THANK YOU SO MUCH

    I am now having a funny issue

    If i send a test email to a different email address on my domain (i.e. i put myemail@mydomain.com in column J) the emails come through fine from my returns@mydomain.com email so the code works.

    however any other external email addresses in column J (i.e. my gmail email) i get the following error:

    Run-time error ‘-2147220977 (8004020f)’:
    The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Relaying not allowed! Bad sender IP address

    I sense this is less of a code issue but something else - any ideas?

  8. #8
    Registered User
    Join Date
    06-11-2014
    Posts
    5

    Wink Re: Need help getting excel to send automatic emails based on cell value

    I have now solved the issue. Simply using the spreadsheet directly on my company network with no changes to the code solved the issue and emails sent fine to both internal and external emails with no run time errors. The runtime error must have just been due to the company server blocking my home IP address or something.

    HUGE thank you to judgeh59 for the code!!!

+ 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. Replies: 2
    Last Post: 12-19-2014, 11:28 AM
  2. [SOLVED] How do I enable Excel 2007 to send automatic emails to outlook
    By Joe McCabe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-18-2014, 09:26 AM
  3. VBA code to send automatic emails via outlook based on deadline
    By Britny in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2013, 10:08 AM
  4. Send automatic emails from excel.v2
    By JasonHopkins in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-12-2012, 11:26 AM
  5. Send automatic emails from excel
    By JasonHopkins in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-09-2012, 08:06 AM

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