2

I repeatedly have to send emails that are nearly identical except they have a different case number. I'd like to setup outlook to just ask me for the case number, fill it in the appropriate place in the body and subject of the email and then send it to a preset list of recipients (it's a static list of people).

I think some combination of Forms and Templates should be able to do this but I'm unsure how.

1 Answer 1

0

A possible VBA solution

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

Editor and button help - http://www.slipstick.com/developer/how-to-use-outlooks-vba-editor/

Macro security should be set to medium.

Button help - http://www.howto-outlook.com/howto/macrobutton.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .