0

As a continuous process to improve our customer service at our helpdesk I'm looking to integrate a functionality in our outlook so that we can reply to existing e-mails using outlook template's (.oft).

My search online mostly gave me results for auto-reply'ing. However this is not what I (we) need.

We are in need for a tool that enables us to select from a list of standard templates (with subject oriented reply's). http://replywith.4team.biz/ Gives a solution in the right direction, however, as with any company, we would like a free tool.

Is this programmable in VBA? And if so, how?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
ThomasSt
  • 185
  • 1
  • 14

4 Answers4

2

VBA sample based on http://msdn.microsoft.com/en-us/library/office/ff865637.aspx

Sub CreateReplyFromTemplate() 
 
    dim currItem  As Outlook.MailItem 
    dim currItemReply  As Outlook.MailItem 
    Dim MyItem As Outlook.MailItem 
 
    set currItem = activeinspector.currentitem
    Set curritemReply = currItem.Reply
    Set MyItem = Application.CreateItemFromTemplate("C:\HelpTopic1.oft") 

    MyItem.To = currItemReply.To
    MyItem.htmlbody = MyItem.htmlbody  & currItemReply.htmlbody

    currItemReply.close oldiscard
    currItem.close  oldiscard

    MyItem.Display 

    set curritemReply = nothing
    set MyItem = nothing
    set currItem = nothing
End Sub

Deploying the VbaProject.OTM file VbaProject.OTM deployment

Reply with a message template via Quick Steps - http://www.msoutlook.info/question/665

Working with message templates - http://www.howto-outlook.com/howto/messagetemplates.htm

niton
  • 8,771
  • 21
  • 32
  • 52
0

Of course you can do that in VBA, but would you really want to? You can buy 10 licenses of that tool for $99.50. I don't know where you work, but at most software companies $99.50 will buy you about an hour worth of programmer's time (benefits included). You probably could have bought 1 license if you saved the time it took you to post this question.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Dmitry, thank you for your reply. We will be needing this function on +- 50 outlook clients, so that's a cost of about $397.50. Depending on how easy this would be to code, buying the license at this point is not opportune. – ThomasSt Nov 22 '13 at 08:35
  • If I were to write a utility like that, I'd estimate at least a few days just to get something ready for testing. There are a lot of things to do: create a COM addin, make it create Outlook ribbon buttons for each reply and a button to manage the UI for creating and editing templates. Which part are you having problem with? $397.50 is still a bargain compared to several days of development and testing. – Dmitry Streblechenko Nov 22 '13 at 14:19
0

Just to add to the answer above, in sub CreateReplyFromTemplate() instead of

Set curritemReply = currItem.Reply

Replace with

Set currItem = Application.ActiveExplorer().Selection(1)
Aven
  • 1
  • 1
0

I'm trying to do this exact same thing, and yes, it is possible. I have two versions of the code, one that gives you an input box and allows you to type the template name and retrieves them applies to a reply. And another one that is supposed to the same thing, but use a userform so that the user can choose any templates and apply them with only one click in a nice menu. Unfortunately the second code is broken ( problems with buttons and userform interacting with the module), but the text input one works ok!

Sub AUTOS1()
Dim objItem As Object
Dim mail As MailItem
Dim replyall As MailItem
Dim templateItem As MailItem
Dim templatePath As String
Dim templates As New Scripting.Dictionary
Dim templateName As String

'Add the names and full paths of the templates you want to use here
templates.Add "Shipping", ("C:\Users\user02\AppData\Roaming\Microsoft\Templates\Shipping.oft")
templates.Add "Preadvice", ("C:\Users\example\AppData\Roaming\Microsoft\Templates\PreAdvice.oft")
templates.Add "Documents", ("C:\Users\user02\AppData\Roaming\Microsoft\Templates\Documents.oft")

'Displays a dialog box asking the user to enter the name of the template
templateName = InputBox("Enter the name of the template you want to use:")

'Retrieves the full path of the template from the name entered by the user
If templates.Exists(templateName) Then
    templatePath = templates(templateName)
Else
    MsgBox "Template not found."
    Exit Sub
End If

'Opens the selected template
Set templateItem = Application.CreateItemFromTemplate(templatePath)

For Each objItem In ActiveExplorer.Selection
    If objItem.Class = olMail Then
        Set mail = objItem
        Set replyall = mail.replyall
        'Adds the contents of the template to the body of the reply message
        replyall.HTMLBody = templateItem.HTMLBody & replyall.HTMLBody
        replyall.Display
    End If
Next
End Sub

Remember to allow macro and make sure the references for outlook,scripting services,etc are enabled