+ Reply to Thread
Results 1 to 3 of 3

VBA solution to validate email address syntax

  1. #1
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    Pro 2019
    Posts
    16,166

    VBA solution to validate email address syntax

    The attached file has a VBA function to test the syntax of an email address. This validation conforms to all elements of the standard except:

    • Nested comments are allowed by the standard but will result in a false negative
    • Quoted strings are allowed by the standard but will result in a false negative


    Feel free to note any failure cases that you find.
    Attached Files Attached Files
    Making the world a better place one fret at a time | | |會 |會 |會 |會 | |:| | |會 |會
    Please read the rules
    If someone helped you, click on the star icon at the bottom of their post
    If your problem is solved, go to Thread Tools and select Mark This Thread Solved
    Don't attach a screenshot--just attach your Excel file! It's easier and will let us experiment with your data, formulas, and code.

  2. #2
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016
    Posts
    642

    Re: VBA solution to validate email address syntax

    Hi, I have this valid emailaddress that gives a False too: <Name.Lastname@gmail.com> (this is just copied from Windows10 messenger)

    I know this < maybe not part of an emailaddress but my program swallows it

    Cheers
    Erwin
    Last edited by Eastw00d; 06-23-2020 at 12:11 AM. Reason: additional information
    I started learning VBA because I was lazy ...
    Still developing....

  3. #3
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    Pro 2019
    Posts
    16,166

    Re: VBA solution to validate email address syntax

    I will have to think about this one. Technically the < > characters are not part of the email address and are in fact illegal in an email address, but mail clients use this notation to allow specifying a display name

    FirstName LastName <firstname.lastname@gmail.com>

    The parser could be modified to recognize this. I'll look at this.

+ 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] Validate Email Address on TextBox
    By DonJuan85 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-29-2015, 02:05 PM
  2. [SOLVED] Validate EMail Address
    By shyam sundar in forum Outlook Formatting & Functions
    Replies: 7
    Last Post: 11-10-2014, 05:39 PM
  3. Validate email address in the correct format
    By PhotoJoe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-12-2009, 12:37 PM
  4. Validate an email address
    By hustla7 in forum Excel General
    Replies: 2
    Last Post: 08-27-2006, 01:55 PM
  5. [SOLVED] Validate an Email Address
    By Duncan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-26-2006, 02:40 PM
  6. Validate email address
    By Ken Valenti in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-23-2006, 08:35 PM
  7. [SOLVED] Validate an email address
    By BethP in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2005, 07:05 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