可以決定範本、新增其他收件者、編輯主題行的宏

可以決定範本、新增其他收件者、編輯主題行的宏

我是VBA 新手,我想創建一個Outlook 宏,它可以根據“收件人”字段決定使用哪個模板,將特定收件人添加到“抄送”和“密件抄送”字段,將字符串添加到現有主題(例如“example_subject”) -->“確認\範例_主題”)。

我的努力得到了這樣的結果:

Sub PO_confirmation()

    Dim myItem As Outlook.mailItem

    Dim recipients As Outlook.recipients
    Dim recipientTo As Outlook.recipient
    Dim recipientCC As Outlook.recipient
    Dim recipientBCC As Outlook.recipient

    Set myItem = ActiveInspector.CurrentItem


    Set recipientTo = myItem.recipients.Add("[email protected]")
    recipientTo.Type = Outlook.OlMailRecipientType.olTo

    Set recipientCC = myItem.recipients.Add("[email protected]")
    recipientCC.Type = Outlook.OlMailRecipientType.olCC

    Set recipientBCC = myItem.recipients.Add("[email protected]")
    recipientBCC.Type = Outlook.OlMailRecipientType.olBCC

    initialSubj = myItem.Subject
    myItem.Subject = "RE:ABC-" & initialSubj

    myItem.Display

End Sub

現在的問題是密件副本收件者總是出現在「收件者」欄位中,我不知道出了什麼問題?

相關內容