Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using VBA, (Visual Basic For Application), Write a sub procedure that requires a

ID: 3647541 • Letter: U

Question

Using VBA, (Visual Basic For Application), Write a sub procedure that requires a user to enter an email address (e.g., jones443@comcast.com) via an input box. The required format is username@domain.com. - The input box should display a default prompt showing the user the expected format of the email address to be entered. - The user should be notified (via a message box) if the email address entered does not meet the following requirements: - It is not in the format username@domain.com. Entries such as usernamedomain.com or username@domain are considered incorrect. -The suffix is not exactly three characters in length. If any of the above input error conditions is true, the input box must be presented again until the user provides the email address in the required format. -Once the user enters the email address in the required format, display the full email address in cell

Explanation / Answer

Public Function IsValidEmail(ByVal Email As String) As Boolean Dim strRegex As String = "^([a-zA-Z0-9_-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-zA-Z0-9-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$" Dim _Regex As New System.Text.RegularExpressions.Regex(strRegex) Return _Regex.IsMatch(Email) End Function

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote