【问题标题】:Outlook 2010 New Email SignatureOutlook 2010 新电子邮件签名
【发布时间】:2014-10-02 12:45:08
【问题描述】:

我希望能够在 Outlook 2010 中创建一个自定义的“新电子邮件”按钮,以设置具有与默认签名不同的新电子邮件。我查看了其他帖子中的各种解决方案,但似乎没有适合这个特定用例的解决方案。这就是我所追求的:

我有一个电子邮件帐户,该帐户将与两个独立的业务实体相关联,每个实体都有自己的签名。我想找到一种基于使用的“新电子邮件”按钮自动选择一个或另一个签名的方法。我使用 Outlook 邮件属性中的默认签名分配为第一个实体添加了签名。我在功能区中添加了一个自定义的新电子邮件按钮,我想在创建新电子邮件时使用第二个实体签名。

这可能吗?关于如何实现这一点的任何想法?

【问题讨论】:

    标签: vba outlook email-client


    【解决方案1】:

    将默认签名设置为无。

    使用两个不同的签名创建两个模板。创建两个自定义按钮。

    http://msdn.microsoft.com/en-us/library/office/ff865637%28v=office.15%29.aspx

    Sub CreateFromTemplate1() 
        Dim MyItem As Outlook.MailItem 
        Set MyItem = Application.CreateItemFromTemplate("C:\template1.oft") 
        MyItem.Display 
    End Sub 
    
    Sub CreateFromTemplate2() 
        Dim MyItem As Outlook.MailItem 
        Set MyItem = Application.CreateItemFromTemplate("C:\template2.oft") 
        MyItem.Display 
    End Sub
    

    【讨论】:

      【解决方案2】:

      这里有生成签名的代码。

      http://www.rondebruin.nl/win/s1/outlook/signature.htm

      应该看起来像这样。

      Sub Mail_Outlook_With_Signature_Html_2_shortened()
      '
      ' http://www.rondebruin.nl/win/s1/outlook/signature.htm
      '
      ' Don't forget to copy the function GetBoiler in the module.
      ' Working in Office 2000-2013
      
          Dim OutMail As Object
          Dim SigString As String
          Dim Signature As String
      
          Set OutMail = CreateItem(0)
      
          'Change only Mysig.htm to the name of your signature
          SigString = Environ("appdata") & _
                      "\Microsoft\Signatures\Mysig.htm"
      
          If Dir(SigString) <> "" Then
      
              Signature = GetBoiler(SigString)
              With OutMail
                  .HTMLBody = "<br>" & Signature
                  .Display
              End With
      
          Else
      
              MsgBox "Signature file not found." & vbCr & SigString
      
          End If
      
          Set OutMail = Nothing
      
      End Sub
      
      Private Function GetBoiler(ByVal sFile As String) As String
      'Dick Kusleika
          Dim FSO As Object
          Dim ts As Object
          Set FSO = CreateObject("Scripting.FileSystemObject")
          Set ts = FSO.GetFile(sFile).OpenAsTextStream(1, -2)
          GetBoiler = ts.readall
          ts.Close
      End Function
      

      【讨论】:

        猜你喜欢
        • 2016-10-18
        • 1970-01-01
        • 2017-07-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多