+ Reply to Thread
Results 1 to 11 of 11

Sending two different emails to two different recipients with single button using vba

  1. #1
    Registered User
    Join Date
    12-23-2013
    Location
    houston
    MS-Off Ver
    excel 2013
    Posts
    6

    Sending two different emails to two different recipients with single button using vba

    Hello,

    I am trying to use one button to send multiple emails to two different people. The messages and email addresses are in cells in the spread sheet, so I refer to them as ranges. When I click the button, the first email goes out perfectly, but the second one never sends. Can someone please help me? Here is what I have so far:
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 12-23-2013 at 07:14 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Sending two different emails to two different recipients with single button using vba

    Hello ahowe,

    Welcome to the Forum!

    Remove the On Error Resume and On Error Goto statements. If your macro is written correctly, you will not have any errors.

    If you do receive an error, note the error number and the message. Post both of these should an error occur. It will make it easier to fix the problem.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    12-23-2013
    Location
    houston
    MS-Off Ver
    excel 2013
    Posts
    6

    Re: Sending two different emails to two different recipients with single button using vba

    Thanks for the tip. When I did that and clicked the button, I got an error saying "the item has been moved or deleted" when I am in the code window and just click run, I get an error saying "automation error"

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Sending two different emails to two different recipients with single button using vba

    Hello ahowe,

    Okay, let's try replacing the Send with Display. This will open Outlook and display the email. Let me know what happens.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Sending two different emails to two different recipients with single button using vba

    Hello ahowe,

    After looking closer at your code, I saw a few mistakes. Try this version.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-23-2013
    Location
    houston
    MS-Off Ver
    excel 2013
    Posts
    6

    Re: Sending two different emails to two different recipients with single button using vba

    I get the same error: "Item has been moved or deleted" with ".To = Email2" highlighted. Not sure why that is happening?

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Sending two different emails to two different recipients with single button using vba

    Hello ahowe,

    Can you post the workbook?

    How To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.

  8. #8
    Registered User
    Join Date
    12-23-2013
    Location
    houston
    MS-Off Ver
    excel 2013
    Posts
    6

    Re: Sending two different emails to two different recipients with single button using vba

    Here you go
    Attached Files Attached Files

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Sending two different emails to two different recipients with single button using vba

    Hello ahowe

    I forgot that after an email is sent, Outlook sets the object to Nothing. It must be created again or an error will occur. This code works.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    12-23-2013
    Location
    houston
    MS-Off Ver
    excel 2013
    Posts
    6

    Re: Sending two different emails to two different recipients with single button using vba

    That worked!! Thank you very much! You saved me a lot of headache.

  11. #11
    Registered User
    Join Date
    12-23-2013
    Location
    houston
    MS-Off Ver
    excel 2013
    Posts
    6

    Re: Sending two different emails to two different recipients with single button using vba

    Another quick question though. If I had multiple emails in a certain cell and I wanted to send one of the messages to all emails in that cell, how would I do that?
    Is there some "Dim range as list" or something along those lines?

+ 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. [SOLVED] Sending Outlook emails from Excel; Limits to three emails only?
    By BPSJACK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2013, 06:53 AM
  2. sending emails using macro button from excel, with variable data
    By GShep in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2012, 06:15 AM
  3. Sending macro emails using excel: Send emails with their passwords.
    By loveisblind in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2009, 03:16 PM
  4. Delay sending to multiple recipients from one message
    By Reema in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 02-27-2009, 02:37 AM
  5. [SOLVED] Sending Attachments to multiple recipients
    By Prabha in forum Excel General
    Replies: 3
    Last Post: 01-24-2005, 12:06 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