Consulting

Results 1 to 2 of 2

Thread: Add classification prefix to subject line of all outgoing messages

  1. #1
    VBAX Newbie
    Joined
    Dec 2017
    Posts
    1
    Location

    Add classification prefix to subject line of all outgoing messages

    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?

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    What happens?

    Did you create the userform shown in

    https://stackoverflow.com/questions/...outlook-add-in

    What version of Outlook at you using?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •