How to insert specific text at cursor when composing message in outlook?
Supposing, you have some specific text strings which are used frequently when composing the email message, so, you would like to insert the text at the current position of the cursor in the mail body automatically without manually typing them again and again. This article, I will talk about an easy method for solving this task quickly.
Insert specific text at any location when composing message:
With Kutools for Outlook's Auto Text feature, you can create an auto text, and then insert it anywhere when composing message as you need.
Kutools for Outlook: with more than 20+ handy Excel add-ins, free to try with no limitation in 60 days. Download and try the free trial now!
The following VBA code can help you to insert a specific text string or current date at the cursor position, please do as this:
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. And then, click Insert > Module, copy and paste below code into the opened blank module:
VBA code: Insert specific text or current date at cursor
Option Explicit Public Sub InsertInfoToSelection() Dim xDoc As Word.Document Dim xSel As Word.Selection On Error Resume Next Select Case TypeName(Application.ActiveWindow) Case "Explorer" Set xDoc = Application.ActiveExplorer.Selection(1).GetInspector.WordEditor Case "Inspector" Set xDoc = Application.ActiveInspector.WordEditor End Select Set xSel = xDoc.Application.Selection xSel.InsertBefore Format("ExtendOffice") Set xDoc = Nothing Set xSel = Nothing End Sub
Note: In the above code, ExtendOffice is the specific text that you want to insert, if you need to insert current date instead of the text string, please change the text in this script xSel.InsertBefore Format("ExtendOffice") to xSel.InsertBefore Format(Now, "DD/MM/YYYY").
3. Then, save and close the code window, create a new email, and in the Message window, click Customize Quick Access Toolbar drop down, and choose More Command, see screenshot:
4. In the Outlook Options dialog box, please do the following operations:
(1.) Select Macros from the Choose command from drop down;
(2.) Click the macro name you have inserted;
(3.) Then, click Add button to add this macro to the Customize Quick Access Toolbar list box.
5. And then, click OK button to close the dialog box, now, the macro icon has been inserted into the Customize Quick Access Toolbar. Put the cursor where you want to insert the text, and then click this macro button, the specific text will be inserted at once, see screenshot:
Kutools for Outlook
More than 100 Advanced Functions for Outlook 2010, 2013, 2016, 2019 and 365