Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Module: EmailValidation in Category General VBA/VB6 : String Handling from Total Visual SourceBook

Verify an email address or set of email addresses conforms to standards in VBA and VB6.

Procedure List

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the modEmailValidation module
IsEmailOK Procedure Determine if one Email address is okay. Email can be simply "name@fmsinc.com" or include a friendly name " name@fmsinc.com" with either part in brackets
GetEmailParts Procedure Get the three component parts of an email ( name@website.com) or (friendly name ).
CheckEmailName Procedure Verify the name portion of an email address (text before the @ symbol).
CheckDomain Procedure Verify the domain portion of an email address (text after the @ symbol). Based on this required format: No spaces, must have a "." but can't start or end with it. Only letters, numbers, ".", and "-" allowed.
IsMultipleEmailOK Procedure Validate a list of email addresses against standard email formats -- does not determine if the email address is a valid recipient or domain.
SeparateMultipleEmails Procedure Separate an email string with multiple email addresses into an array of individual email addresses. Emails may be separated by ; , chr(10) or chr(13).

Example Code for Using Module: EmailValidation

' Example of modEmailValidation
'
' To use this example, create a new module and paste this code into it.
' Then run the procedure by putting the cursor in the procedure and pressing:
'    F5 to run it, or
'    F8 to step through it line-by-line (see the Debug menu for more options)

Private Sub Example_modEmailValidation()
  ' Comments: Examples of modEmailValidation to verify an email address or set of email addresses conforms to standards in VBA and VB6.
  '           See the Immediate Window for the results.

  Dim strEmail As String
  Dim astrEmail() As String
  Dim strBadEmail As String
  Dim strFriendly As String
  Dim strName As String
  Dim strDomain As String

  Dim i As Integer

  strEmail = InputBox("Enter one or more email addresses, separated by ; or ,", , "support@fmsinc.com, fms@fmsinc.com")

  ' Demonstrate IsMultipleEmailOK
  If Not IsMultipleEmailOK(strEmail, True, strBadEmail) Then
    MsgBox "No email addresses entered or bad email address(es) found: " & strBadEmail
  Else
    MsgBox "All email addresses OK"

    ' Demonstrate SeparateMultipleEmails
    Debug.Print SeparateMultipleEmails(strEmail, astrEmail) & " email(s) read into array."

    For i = 1 To UBound(astrEmail)
      Debug.Print "---------------------------"
      Debug.Print astrEmail(i)

      ' Demonstrate IsEmailOK
      Debug.Print "IsEmailOK: " & IsEmailOK(astrEmail(i))

      ' Demonstrate GetEmailParts
      If GetEmailParts(astrEmail(i), strFriendly, strName, strDomain) Then
        Debug.Print "   Friendly Name: " & strFriendly
        Debug.Print "   Name: " & strName
        Debug.Print "   Domain: " & strDomain

        ' Demonstrate CheckEmailName
        Debug.Print "CheckEmailName: " & CheckEmailName(strName)
        ' Demonstrate CheckDomain
        Debug.Print "CheckDomain: " & CheckDomain(strDomain)

      End If

    Next i

  End If

End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources