PDA

View Full Version : Add classification prefix to subject line of all outgoing messages



temp89
12-14-2017, 07:16 AM
I'm trying to follow the very similar request in this thread

/showthread.php?43155-Macro-for-sending-emails-to-give-classification-prefix-options-to-the-subject-line

but pasting the below code into ThisOutlookSession in VBA results in nothing occuring


Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim frm As UserForm1
Dim chosenvalue As String


Set frm = New UserForm1


frm.Show vbModal


Select Case True
Case frm.OptionButton1.Value
chosenvalue = "PERSONAL"
Case frm.OptionButton2.Value
chosenvalue = "UNCLASSIFIED"
Case frm.OptionButton3.Value
chosenvalue = "CLASSIFIED"
Case Else ' no value chosen
MsgBox "you did not select a value. cancelling send."
Cancel = True
Exit Sub
End Select


If TypeName(Item) = "MailItem" Then
Item.Subject = Item.Subject & " [SEC=" & chosenvalue & "]"
End If


End Sub

Am I missing something obvious?

Paul_Hossler
12-14-2017, 04:00 PM
What happens?

Did you create the userform shown in

https://stackoverflow.com/questions/7711975/options-in-vba-outlook-add-in

What version of Outlook at you using?