在模板之后添加常用的签名

我有这个问题,如果我必须通过Excel VBA在我的Outlook邮件中添加签名,不包括签名。 它只被模板覆盖。 如果你问我如何插入模板,请点击这里 ,这是我以前的问题。 而我现在的问题是在模板后面插入一个签名。 这是我迄今为止所尝试的:

Dim objMail as Object, attach as object, wordDoc as Word.Document Dim main as Worksheet, rngBody as Range set main = Thisworkbook.sheets("Main") Set objMail = objOutlook.CreateItem(0) Set attach = objMail.attachments Set wordDoc = objMail.GetInspector.WordEditor With main Set rngBody = .Range(.Range("B12:M31"), .Range("B12:M31")) rngBody.Copy End With With objMail .Subject = "Sample" .To = "chu@chuchu.com" wordDoc.Range.PasteAndFormat wdChartPicture & .htmlbody = " " 'I've tried this 3 instances signature = objMail.body '.body = signature 'htmlBody = signature .Display End With 

我在正确的道路上吗? 因为所有这些只被模板覆盖。 谢谢。

首先存储签名,然后再添加它。

 Sub sig() Dim objMail As mailItem Dim signature As String Set objMail = CreateItem(0) With objMail .Display ' This is necessary to generate the default signature signature = objMail.HTMLBody Debug.Print signature ' Having saved the signature, you can manipulate the body .HTMLBody = "test" ' Now you can add the saved signature to the end .HTMLBody = .HTMLBody & signature End With End Sub