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.
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:
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 100 handy Excel add-ins, free to try with no limitation in 60 days. Download and try the free trial now!
- Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
- BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
- Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
- Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
- Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.