簡體   English   中英

如何使用模板回復所有人?

[英]How to Reply to All using a template?

我正在嘗試使用特定模板執行“全部回復”命令。

這是我到目前為止所擁有的:

Sub my_test()
    
    Dim mail 'object/mail item iterator
    Dim replyall 'object which will represent the reply email
    
    For Each mail In Outlook.Application.ActiveExplorer.Selection
        If mail.Class = olMail Then
            Set replyall = mail.replyall
            With replyall
                .Body = "My template from a oft file"
                .Display
            End With
        End If
    Next
    
End Sub

在正文中,我想使用我在 c:\mytemplate.oft 中的一個經常文件中的模板。

當我回復時,在底部我想要原始的 email 而在 email 正文的頂部我想要來自現有模板的文本。

想法是使用此代碼(如果可能),並將模板正文文件的上下文(文本和表格)放置在此回復 email 內(在頂部)。

Outlook 的代碼。 Excel 標簽沒有明顯的用途。

Option Explicit

Sub my_test()

Dim objItem As Object

Dim mail As MailItem
Dim replyall As MailItem

Dim templateItem As MailItem

For Each objItem In ActiveExplorer.Selection

    If objItem.Class = olMail Then
    
        Set mail = objItem
        Set replyall = mail.replyall
                
        Set templateItem = CreateItemFromTemplate("C:\template.oft")
        
        With replyall
            .HTMLBody = templateItem.HTMLBody & .HTMLBody
            .Display
        End With
        
    End If
    
Next

End Sub

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM