Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Form Field Validation 1

Status
Not open for further replies.

joelrob

IS-IT--Management
Jul 15, 2003
77
US
Trying to force users to include the job number in the subject of every e-mail that goes out. Anyone know a good tutorial for taking the string of the subject and searching for six integers inside that string?

Not looking for that specifically, but a good starting point. Most of the validation tutorials I've found have been incredibly basic.

TIA
 
Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
   Dim regex As Object
   Set regex = CreateObject("VBScript.RegExp")
   
   regex.Global = True
   regex.Pattern = "[0-9]{6}"
   
   If Not regex.Test(Item.subject) Then
      MsgBox "Include the job number in the subject line"
      Cancel = True
   End If
End Sub
 
Just what I was looking for, thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top