【问题标题】:Insert signature after the pasted body in Outlook mail using Excel VBA使用 Excel VBA 在 Outlook 邮件中粘贴的正文后插入签名
【发布时间】:2018-12-19 07:40:17
【问题描述】:

我正在使用下面的代码从 Excel 创建电子邮件:

Sub TEST()

Dim outlook As Object
Dim newEmail As Object

Set outlook = CreateObject("Outlook.Application")
Set newEmail = outlook.CreateItem(0)

With newEmail
    .To = Sheet1.Range("L2").Text
    .Subject = Sheet1.Range("E1").Text

    ' .Body = "" & vbNewLine & signature
    .Display

    Dim xInspect As Object
    Dim pageEditor As Object

    Set xInspect = newEmail.GetInspector
    Set pageEditor = xInspect.WordEditor

    Sheet1.Range("B4:L37").Copy

    pageEditor.Application.Selection.Start = Len(.Body)
    pageEditor.Application.Selection.End = pageEditor.Application.Selection.Start
    pageEditor.Application.Selection.Paste

    Set pageEditor = Nothing
    Set xInspect = Nothing
End With

Set newEmail = Nothing
Set outlook = Nothing

End Sub

我的签名会自动出现在正文之前。

之后有没有办法插入我的签名?

【问题讨论】:

  • 你能展示你的excel表格的样本吗?

标签: excel vba outlook outlook-2010


【解决方案1】:

在 Excel 的新工作表中创建签名并将其添加到电子邮件正文中,就像您为正文内容所做的一样,这比自定义签名更好。

否则你可以使用这个想法:

if  Not (Account  Is  Nothing)  Then
   set Signature = Account.NewMessageSignature
   if  Not (Signature  Is  Nothing)  Then
    Signature.ApplyTo Msg,  false   'apply at the bottom
   End If
End If

来自这篇文章: How to add default signature in Outlook

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-01
    • 2015-03-23
    • 2017-12-05
    • 1970-01-01
    • 2022-08-14
    • 1970-01-01
    相关资源
    最近更新 更多