1

I send an email with VBA. A classification is popped up for each email and it needs to be set by hand. I am trying to work around this in the code.

I found a code to send emails: Mail a message with outlook via VBA.
After fixing few things, the following code is working.

Sub sendEmail()
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
'Working in Office 2000-2016
    Dim OutApp As Object
    Dim OutMail As Object
    Dim cell As Range
    
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    Set OutApp = CreateObject("Outlook.Application")
    
    On Error GoTo cleanup
    For Each cell In Columns("B").Cells.SpecialCells(xlCellTypeConstants)
        Set OutMail = OutApp.CreateItem(0)
        On Error Resume Next
        With OutMail
            .To = cell.Value
            .Subject = "Reminder"
            .Body = "Dear " & Cells(cell.Row, "A").Value _
              & vbNewLine & vbNewLine & _
              "Please Finish your course " & Cells(cell.Row, "C") & _
              " before expiry date."
            .Send  'Or use Display
        End With
        On Error GoTo 0
        Set OutMail = Nothing
    Next cell

cleanup:
    Set OutApp = Nothing
    Application.ScreenUpdating = True
End Sub

The problem is that after sending emails from the list to for example 10 persons, I need to click on classification pop up 10 times.

I found this: How to save workbook and handle TITUS (or any other document classification add-in) popup?

I tried .EnableEvents = False before .Send. I am not sure if this does serve me.

How to use this in my case? Is it doable to disable it, work around it, or even set a classification within the code?

ZygD
  • 22,092
  • 39
  • 79
  • 102
Abdullah Salma
  • 560
  • 7
  • 20
  • Is it an add-in for Outlook or Excel? Did you try to disable add-in altogether at least for the time your code executes? – AntiDrondert Mar 06 '18 at 11:56
  • @AntiDrondert it is installed by the company for all Microsoft Office applications. to handle information. can not be disabled. Pops up done by outlook on outgoing emails. – Abdullah Salma Mar 06 '18 at 18:00
  • You will need to get the settings of TITUS changed. Contact your administrator and tell them what you are doing. – HackSlash Mar 06 '18 at 19:11

1 Answers1

1

There is a workaround, but you have to do it in Outlook Developer itself. You can set up an event handler in Outlook which triggers a macro. So, in this case, Outlook could watch for a message to be created with a specific subject line (as an example), and THAT would trigger the script below, which bypasses TITUS.

'Sets Titus Mail settings and sends mail
    With AOMailMsg
        objMsg.ItemProperties.Add("ABCDE.Registered To", olText) = "My Companies"

        objMsg.ItemProperties.Add("ABCDE.Classification", olText) = "Internal"
        objMsg.UserProperties.Add("ABCDE.Registered To", olText) = "My Companies"
        objMsg.UserProperties.Add("ABCDE.Classification", olText) = "Internal"
        objMsg.UserProperties.Add("TITUSAutomatedClassification", olText) = _
             "TLPropertyRoot=ABCDE;.Registered To=My Companies;.Classification=Internal;"
        objMsg.Send
    End With
Mark L.
  • 11
  • 3