title: How can I assign category of sent mail in outlook vba?
body: <p>I followed the below example: </p>
  
  <p><a href="https://www.slipstick.com/developer/create-a-new-message-using-vba/" rel="nofollow noreferrer">https://www.slipstick.com/developer/create-a-new-message-using-vba/</a></p>
  
  <p>I want to categorize mail automatically when I send an email by macro.
  but, sometimes category is in category.</p>
  
  <p>For example, suppose, "Report" Category is under "Company" Category.</p>
  
  <p>How can i assign my sent mail to "Report" Category in "Company" Category?
  Here is my code. it is almost same with the example code.</p>
  
  <pre><code>Public Sub CreateNewMessage()
  Dim objMsg As MailItem
  
  Set objMsg = Application.CreateItem(olMailItem)
  
  With objMsg
    .To = "Alias@domain.com"
    .CC= "Alias2@domain.com"
    .BCC = "Alias3@domain.com"
    .Subject = "This is the subject"
    .Categories = "Test"
    .VotingOptions = "Yes;No;Maybe;"
    .BodyFormat = olFormatPlain ' send plain text message
    .Importance = olImportanceHigh
    .Sensitivity = olConfidential
    .Attachments.Add ("path-to-file.docx")
  
   ' Calculate a date using DateAdd or enter an explicit date
    .ExpiryTime = DateAdd("m", 6, Now) '6 months from now
    .DeferredDeliveryTime = #8/1/2012 6:00:00 PM#
  
    .Display
  End With
  </code></pre>