+ Reply to Thread
Results 1 to 2 of 2

Validation in the email address textbox

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Validation in the email address textbox

    Hi Guys

    I have a userform and in that there is a multiline textbox and Email Button. The user has to enter the email address/email addresses in that. I have written the note in a label that if there are more than 1 textbox then separate the email addresses using Semi colon sign ie. ; and when they press Email button then the code works and send the email across those email addresses but in case the user forgets to separate the email addresses using ; then no email gets sent out. I want to put the validation in multiline textbox so that if the email addresses are not separated using ; then throw an error message.

    Please Login or Register  to view this content.
    ANy help will be much appreciated.

    Thanks

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Validation in the email address textbox

    Hi there,

    Try the following code and see if it does what you need.

    The code assumes that if Users do NOT use a separating semicolon, they will insert at least one space character between email addresses, and it checks to see if there is a semicolon immediately before that space. If no semicolon is present an error message is generated. Email addresses separated only by semicolons (i.e. semicolons NOT followed by a space) are considered valid.

    Please Login or Register  to view this content.

    You should note that if (for whatever reason) the code which sends your email crashes, the "On Error Resume Next" statement will prevent you from being aware of this! It might be better to use ".Display" instead of ".Send", so that at least you'll be aware that your expected email has not been displayed. If you'd prefer to have the email sent automatically, I can show you a code modification which will generate an error message if the email has not been sent.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Last edited by Greg M; 08-25-2015 at 09:12 AM. Reason: Minor change

+ 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. Email a screenshot of a specifc row in an email to a specfic email address
    By Cobra75007 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-19-2015, 10:36 AM
  2. [SOLVED] Validate Email Address on TextBox
    By DonJuan85 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-29-2015, 02:05 PM
  3. Data Validation- email address format?
    By bjohnsonac in forum Excel General
    Replies: 2
    Last Post: 12-08-2014, 04:44 PM
  4. Send email from address in a textbox
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-25-2013, 05:18 PM
  5. [SOLVED] Create CommandButton to send email address maintained in TextBox
    By pipoliveira in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2012, 03:08 PM
  6. Replies: 1
    Last Post: 03-08-2012, 01:57 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