Since that many users think it cumbersome to find and use Outlook email templates, we will exhibit 2 quick methods to create new emails using a template with Outlook VBA in this article.
More often than not, to use an Outlook email template, you have to firstly find out it by clicking “New Items” > “More Items” > “Choose Form”. Then In the “Choose Form” dialog box, locate and open the target templates in “User Templates in File System”, like the following screenshot.
Obviously, it is indeed very troublesome. Therefore, here we will introduce 2 quick means, which can rapidly create new email using templates with the help of Outlook VBA. Read on to get them in detail.
Method 1: Create a New Email Template Directly by Outlook VBA
- At first, turn to “Developer” tab in the Outlook main window.
- Then click on “Visual Basic” button, which will bring out a new window.
- Next, copy and paste the following VBA codes in a module.
Sub CreateNewMail() Dim obApp As Object Dim NewMail As MailItem Set obApp = Outlook.Application Set NewMail = obApp.CreateItem(olMailItem) 'You can change the concrete info as per your needs With NewMail .Subject = Date & " Test Email" .To = "email@example.com" .Body = "Dear Johnny," & vbCrLf & vbCrLf & "I'm glad to write this email to you .......... " & vbCrLf & vbCrLf & "This is just a test email template with Outlook VBA" & vbCrLf & vbCrLf & vbCrLf & "Yours Truly," & vbCrLf & vbCrLf & "John Smith" .Attachments.Add ("C:\Attachments\Test File.docx") .Importance = olImportanceHigh .Display End With Set obApp = Nothing Set NewMail = Nothing End Sub
- After that, exit the “Visual Basic” window. Now follow the steps below to add this macro to Quick Access Toolbar:
- At first, click the down arrow in Quick Access Toolbar and select “More Commands”.
- Then in the new popup window, set “Choose commands from” to “Macros”.
- After that, pitch on the correct one.
- Next, click “Add” button.
- Subsequently, you can change its appearance. Click “Modify” button. In the new dialog box, give it a new name and specify an icon for it.
- Lastly click two “OK”.
- Finally, you can click on the macro icon in the Quick Access Toolbar. Immediately, a new message window will pop up, like the following picture.
Method 2: Create a New Email from an Existing Template by Outlook VBA
- Firstly, you should have a readymade email template in hand. Create a new email in desired format, stationery and save it as Outlook template. For detailed steps, refer to the article “How to Improve Your Work Efficiency via Outlook Templates”. Also, please write down the saving folder path of this template file.
- Then access to “Visual Basic” window and open a new module like the Tip 1.
- Subsequently, you should copy and paste the following screenshot:
Sub CreateEmailfromTemplate() Dim obApp As Application Dim NewMail As Outlook.MailItem Set obApp = Outlook.Application 'Change the template file folder path according to your case Set NewMail = obApp.CreateItemFromTemplate("C:\Users\Test\Documents\Test Mail.oft") NewMail.Display Set obApp = Nothing Set NewMail = Nothing End Sub
- After that, follow the Step 5 in the above Tip 1 to add the new macro to Quick Access Toolbar.
- Eventually you can have a try. You will get the new email using the template, like the image below:
Comparison of the 2 Methods
|Method 1||You can create the email template directly by the VBA codes.||You cannot format the texts in the message.|
|Method 2||You can apply desired stationery and format the texts for the email.||You should create a new email template in advance.|
Cope with Occasional Outlook Errors
Although Outlook is feature rich, it’s still susceptible to various issues. Moreover, the most vexing one is that users cannot start Outlook. In general, it may occur from corrupted Outlook. So you can go to ‘Control Panel” to repair the office suite. If the issue persists, then you have to take recourse to an experienced repair tool, such as DataNumen Outlook Repair.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair SQL Server mdf and outlook repair software products. For more information visit www.datanumen.com