【问题标题】:Insert Signature in Outlook Email在 Outlook 电子邮件中插入签名
【发布时间】:2018-02-16 18:37:59
【问题描述】:

我找到了这段代码,但它不包含签名。在我阅读的所有资源中,我都想不出一个解决方案。

Public Function Email_Test()

Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim objOutlook As Object
Dim Attach As String

Set MyOutlook = New Outlook.Application

Set MyMail = MyOutlook.CreateItem(olMailItem)

MyMail.To = "fakeperson150@gmail.com" '**put in reference to form

'MyMail.CC = MailList("Copy To")

MyMail.Subject = "This Is A Test Email" '**put in reference for subject

MyMail.Body = "Hi," & vbNewLine & vbNewLine & "See attached."

'MyMail.Send
MyMail.Display

Set MyMail = Nothing
Set MyOutlook = Nothing

End Function

【问题讨论】:

标签: excel vba outlook


【解决方案1】:

这是我用来在邮件上附加签名的代码示例。

Sub Email()
     'Working in 2000-2010
     'This example send the last saved version of the Activeworkbook
    Dim OutApp As Object
    Dim OutMail As Object
    Dim Path As String:  Path = Sheet10.Range("H6").Text & " " & Sheet10.Range("I6").Text
    Dim strbody As String

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    strbody = "Attached updated Stock."

    On Error Resume Next
    With OutMail
        .Display
        .To = "annettef@example.co.za"
        .CC = ""
        .BCC = ""
        .Subject = "Fruits Stock " & Path
        .HTMLBody = strbody & .HTMLBody
        .Attachments.Add ActiveWorkbook.FullName
         'You can add other files also like this
         '.Attachments.Add ("C:\test.txt")

    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub

【讨论】:

    【解决方案2】:

    Outlook 是一个 HTML 应用程序。您将需要使用 .HTMLBody 并在您可能输入的任何文本的末尾确保包含.HTMLBody = "text"& .HTMLBody。此.HTMLBody 必须位于电子邮件正文部分的末尾,签名才能自动显示。在为 Outlook 编码时,我会避免尝试使用多种正文类型,而只是坚持使用 HTML。为 Outlook 编码时,请使用 cmets 中 @shmicah 链接中提供的通用格式。如果您的签名没有出现在您想要的位置,请为您需要向下的每一行添加

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-15
      • 1970-01-01
      • 2023-03-09
      • 2012-06-20
      • 1970-01-01
      相关资源
      最近更新 更多