![]() ![]()
If you have more variables, then add a similar block of code for each of them (please see the code parts with the corresponding comments). Please pay attention that there are 4 instances of each placeholder in the code, not counting comments, and all of them should be replaced with your own placeholders. In our sample code, there are two placeholders, and.Be sure to replace this text with the subject of your template. In our case, it's " Your subscription expires soon". The template is identified by its subject.There are two key points in the code that you should take notice of: The values you enter in the boxes will appear exactly where they should in the message: ![]() 'Replace with the entered valueįor each variable mentioned in the code, a separate input box will be displayed: Mail.HTMLBody = Replace(mail.HTMLBody, "", Value) Value = InputBox("Enter percentage discount") Mail.Body = Replace(mail.Body, "", Value) Value = InputBox("Enter the expiry date") If mail.BodyFormat = OlBodyFormat.olFormatPlain Then If mail.Subject = "Your subscription expires soon" Then If TypeOf m_Inspector.CurrentItem Is MailItem Then If TypeOf Inspector.CurrentItem Is Outlook.MailItem Then Private Sub m_Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector) Set m_Inspectors = Application.Inspectors Private WithEvents m_Inspector As Outlook.Inspector Private WithEvents m_Inspectors As Outlook.Inspectors Īnd here is the VBA code that will ask for the values to fill in based on the subject of the email: To keep things simple, I've created this small template with two fields to enter in a message body, and. #HOW TO CREATE A TEMPLATE IN WORD 2010 WITH FIELDS HOW TO#This example shows how to insert variable information in an email template using a macro. Make Outlook email template with variables using VBA Create email template with fillable fields. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |