如何让 Outlook 自动填充信息

如何让 Outlook 自动填充信息

我反复发送几乎完全相同的电子邮件,只是它们的案例编号不同。我想设置 Outlook,让它只询问我案例编号,将其填写在电子邮件正文和主题的适当位置,然后将其发送给预设的收件人列表(这是一个静态的人员列表)。

我认为表单和模板的某种组合应该能够做到这一点,但我不确定如何做。

答案1

可能的 VBA 解决方案

Sub Boilerplate_CaseNumber()

Dim objMail As MailItem
Dim allRecipients As Recipients

Dim uPrompt As String
Dim uCaseNum As String

Set objMail = Application.CreateItem(olMailItem)
Set allRecipients = objMail.Recipients

allRecipients.Add "Your distribution list name inside the quotes"
allRecipients.ResolveAll

uPrompt = "What is the case number?"
uCaseNum = InputBox(prompt:=uPrompt, Title:="Case number")

objMail.Subject = "Here is the Case Number: " & uCaseNum
objMail.Body = "Hello," & vbCrLf & vbCrLf & _
   "The case number is: " & uCaseNum & "." & vbCrLf & vbCrLf & _
   "Yours," & vbCrLf & vbCrLf & _
   "Mykroft"

SendKeys "^{END}"

objMail.Display

Set objMail = Nothing
Set allRecipients = Nothing

End Sub


Sub Boilerplate_CaseNumber_WordEditor()

Dim objMail As MailItem
Dim allRecipients As Recipients

Dim uPrompt As String
Dim uCaseNum As String

Dim objDoc
Dim objSel

Set objMail = Application.CreateItem(olMailItem)
Set allRecipients = objMail.Recipients

allRecipients.Add "Your distribution list name inside the quotes"
allRecipients.ResolveAll

uPrompt = "What is the case number?"
uCaseNum = InputBox(prompt:=uPrompt, Title:="Case number")

objMail.Subject = "Here is the Case Number: " & uCaseNum
objMail.Display

Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).selection
objSel.TypeText Text:="Hello," & vbCrLf & vbCrLf & _
   "The case number is: " & uCaseNum & "." & vbCrLf & vbCrLf & _
   "Yours," & vbCrLf & vbCrLf & _
   "Mykroft"

Set objDoc = Nothing
Set objSel = Nothing
Set objMail = Nothing
Set allRecipients = Nothing

End Sub

编辑器和按钮帮助 -http://www.slipstick.com/developer/how-to-use-outlooks-vba-editor/

宏安全性应设置为中。

按钮帮助 -http://www.howto-outlook.com/howto/macrobutton.htm

相关内容