如何获取空白电子邮件信封模板

时间:2015-05-26 19:48:41

标签: excel excel-vba vba

当我在VBA中使用电子邮件信封方法并首次输入TO,CC和BCC字段时,在下一次迭代期间,只要执行ActiveWorkbook.EnvelopeVisible = True,第一次迭代/旧值就会自动填充。

我们如何使工作簿显示包含空白To,CC和BCC字段值的信封?我每次都想要一个空白信封,这可能吗?

我的代码:

Subj = "Updates"
ActiveWorkbook.EnvelopeVisible = True
    With ActiveSheet.MailEnvelope
       .Item.To = Sendto
       .Item.CC = Sendcc
       .Item.BCC = Sendbcc
       .Item.Subject = Subj & " - " & Format(Now(), "dd-mmm-yyyy")
       .Item.Send
    End With
ActiveWorkbook.EnvelopeVisible = False

1 个答案:

答案 0 :(得分:0)

简单地重置

Sub SendEmailToMe()
    Sendto = "aaa@aa.com"
    SendMEcc = "bbb@aa.com"
    SendMEbcc = "ccc@aa.com"
    Subj = "Updates"

    ActiveWorkbook.EnvelopeVisible = True
    With ActiveSheet.MailEnvelope
       .Item.To = Sendto
       .Item.CC = SendMEcc
       .Item.BCC = SendMEbcc
       .Item.Subject = Subj & " - " & Format(Now(), "dd-mmm-yyyy")

       MsgBox "This is how it looks before you sent it"

       .Item.Send
    End With

    MsgBox "Press Ok to reset it"

    ActiveWorkbook.EnvelopeVisible = True
    With ActiveSheet.MailEnvelope
       .Item.To = " "
       .Item.CC = " "
       .Item.BCC = " "
       .Item.Subject = " "
    End With
End Sub

<强>截图

enter image description here