subject line (1 Viewer)

aarontassell

New member
Local time
Today, 08:40
Joined
Jan 5, 2017
Messages
2
I am trying to create a validation rule that will require the 1st 10 characters of a subject line in outlook to be formatted in the following format:
1st two characters are numbers, 3rd character a hyphen characters 4-7 numbers, 8th character hyphen, last two characters numbers Example (10-2356-00)
I found the validation rule below but not sure how to modify line 4 to accomplish my need. Any assistance would be greatly appreciated.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim strSubject As String
strSubject = Item.Subject
If Len(Trim(strSubject)) >99-9999-99aaaaaa;;_
Prompt$ = "Reminder. Are you sure you added the job number?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + _
vbMsgBoxSetForeground, "Check for Subject") = vbNo Then
Cancel = True
End If
End If
End Sub
 

CJ_London

Super Moderator
Staff member
Local time
Today, 15:40
Joined
Feb 19, 2013
Messages
16,553
surely you just want to know that the various characters are numbers or hyphens in the right places

if so then I would think this should do it

If not (Trim(strSubject) like "##-####-##*") then Prompt$ = "Reminder. Are you sure you added the job number?"
 

aarontassell

New member
Local time
Today, 08:40
Joined
Jan 5, 2017
Messages
2
Worked perfectly, thank you
 

Users who are viewing this thread

Top Bottom