0
我想獲得我的默認簽名,並將其應用於我已設置用戶窗體的電子郵件。我嘗試了幾個選項,包括這一個:How to add default signature in Outlook添加一個默認簽名到Outlook電子郵件VBA
,但它似乎沒有工作...
Private Sub addUpdate_Click()
Dim mailObj As MailItem
Dim mailBody, signature As String
Dim oMail, oApp As Object
newUser.Hide
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
With oMail
.Display
End With
signature = oMail.body
Set mailObj = CreateItem(olMailItem)
mailBody = "<HTML><BODY><P>Hi " & firstName.Value & ",</P>" _
& "<P>Thank you for your interest in the <STRONG>Metropolitan Sales</STRONG> website.</P>" _
& "<P>Some of the features of the website include:</P>" _
& "<UL><LI>Placing Orders</LI><LI>Order status & tracking</LI><LI>Detailed product information</LI>" _
& "<LI>Specification sheets in PDF for all products</LI></UL>" _
& "<P>These features can be accessed at:</P>" _
& "<P><a href= 'http://www.metsales.com'>www.metsales.com</a>, then click on Catalog</p>" _
& "<p><strong>Username : </strong>" & username.Value & "<br>" _
& "<strong>Password : </strong>" & password.Value & "</p>" _
& "<p>Feel free to contact me should you have any questions.</p><br>" _
& "<p>Thank you,</p>" & signature & "</body></html>"
With oMail
.Recipients.add (email.Value)
.Subject = "Metropolitan Sales Username and Password"
.BodyFormat = olFormatHTML
.HTMLBody = mailBody
.Send
End With
Unload newUser
End Sub
你從來沒有設置'signature'任何東西。看看你鏈接到的帖子,你會看到,當第一次創建電子郵件時,HTMLBody **是簽名。您將其存儲在'signature'中,然後在最後加上它,就像您當前的代碼試圖執行的那樣。 –
標記爲[如何在Outlook中添加默認簽名]的副本(http://stackoverflow.com/questions/8994116/how-to-add-default-signature-in-outlook)。如果在這篇文章或者@ DougGlancy的評論中沒有涉及到具體的問題,請修改這個問題:) –
另外請注意,您應該正確'將mailiBody作爲字符串,簽名作爲字符串'以保證安全。 –