+ Reply to Thread
Results 1 to 9 of 9

Problem on sending emails

  1. #1
    Registered User
    Join Date
    12-15-2016
    Location
    Argentina
    MS-Off Ver
    2016
    Posts
    8

    Problem on sending emails

    Hi...I have a simple macro that sends emails. The specific code section looks like

    Please Login or Register  to view this content.
    strto is defined as the current value of the cell and carbon is defined as other value in other cell. Those variables are defined as strings.. if check the values of those variables I see for example "peter@mycompany.com" and "john@mycompany.com" which are correct.

    The problem is that the email is not sent and I get no error. if I hardcode the values instead of the variables with the following:

    Please Login or Register  to view this content.

    the email is sent.

    Anyone can help me to solve the problem?

    Tanks,

    Ezequiel
    Last edited by zek1974; 12-15-2016 at 11:16 AM.

  2. #2
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: Problem on sending emails

    Hi and welcome!
    Show us how you assign strto and carbon variables.
    You could use code tags around posted code (select code and press # button)

  3. #3
    Registered User
    Join Date
    12-15-2016
    Location
    Argentina
    MS-Off Ver
    2016
    Posts
    8

    Re: Problem on sending emails

    Thanks kasan!

    super simple:

    strto = ActiveCell.Value
    carbon = ActiveCell.offset(0,1).Value

    Let me know if you need more info

    Ezequiel

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 2016
    Posts
    4,903

    Re: Problem on sending emails

    Ezequiel,

    Please review the forum rules... particularly rule #3 about using code tags. (please edit your original post to fix this)

    All I can suggest by looking at your post is that there is a problem with the variable's value somehow. There is no obvious reason why it would not work if the variables have the exact same value as your hard-coded email address...
    Perhaps you could provide a sample workbook with the sheet and code... it does not have to have real email addresses or data.
    Last edited by Arkadi; 12-15-2016 at 11:12 AM.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  5. #5
    Registered User
    Join Date
    12-15-2016
    Location
    Argentina
    MS-Off Ver
    2016
    Posts
    8

    Re: Problem on sending emails

    Thanks Arkadi...I corrected the original post.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 2016
    Posts
    4,903

    Re: Problem on sending emails

    Thanks for fixing that... back to the issue at hand... is there any chance that one of the characters in the cells providing the value of strto or carbon are different? or that there is a space in there somewhere? If you checked the values of the variables and they are properly assigned before the "With Outmail" section of the code then it really should be caused by something like that... because the principle seems right. I assume your strto and carbon are assigned earlier in the code and that you are checking their values just before the .send command?

  7. #7
    Registered User
    Join Date
    12-15-2016
    Location
    Argentina
    MS-Off Ver
    2016
    Posts
    8

    Re: Problem on sending emails

    Hi Arkadi...I checked that and all looks good...I built a sample spreadsheet with dummy values attached here. You can see that the macro does not send emails, but if you hardcode the emails on the macro, the email is sent. This is the whole code within:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: Problem on sending emails

    Try not to use Select, Activate.
    Please Login or Register  to view this content.

  9. #9
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 2016
    Posts
    4,903

    Re: Problem on sending emails

    try adding .display before .send...
    shouldn't be needed but you never know...

    I did test your code by putting in my own email, and it worked fine.

+ 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. Sending emails
    By mshussain in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-02-2016, 03:14 PM
  2. Sending Emails under conditions!
    By JVerwee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2013, 05:57 AM
  3. [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
  4. Vba for sending emails
    By shagrath in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2011, 10:28 AM
  5. Sending Emails VBA - Specify Who From
    By BenRoylance in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2010, 06:00 AM
  6. Sending emails
    By Sibrulotte in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-26-2010, 10:31 AM
  7. 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

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