Search code examples
vbaoutlookoutlook-2010

Auto Reply with notes, email body and add CC


I am try to CC second person but I am getting Error run-time 13 Type mismatch.

Option Explicit
'// Auto Replay with notes and email body- run Action Script
Public Sub ReplywithNote(Item As Outlook.MailItem)
    Dim olInspector As Outlook.Inspector
    Dim olDocument As Word.Document
    Dim olSelection As Word.Selection
    Dim olReply As MailItem
    Dim olRecipient As Outlook.Recipient


    Set olReply = Item.ReplyAll
    olReply.Display

    Set olRecipient = myItem.Recipient.Add("omar")
        olRecipient.Type = olCC

    Set olInspector = Application.ActiveInspector()
    Set olDocument = olInspector.WordEditor
    Set olSelection = olDocument.Application.Selection

    olSelection.InsertBefore "Received, Thank you."

    '// Uncomment to send
    olReply.Send

End Sub

Thanks.


Solution

  • Try Recipient not Recipients

     Dim olRecipient As Outlook.Recipient