How to insert a date picker in emails in Outlook?
Suppose you need to send a work schedule to your colleagues, assigning different tasks to different people on different dates. However, you are worried about making mistakes entering the date manually, so you need a date picker instead. This tutorial provides a method to help you insert a date picker in emails in Outlook.
Insert a date picker in Emails in Outlook with VBA code
You can run the following VBA code to insert a date picker in Outlook emails. Please follow the instructions below.
1. Launch your Outlook, press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.
2. In the left pane, double click Project1 > Microsoft Outlook Objects > ThisOutlookSession, and then copy the following VBA code into the ThisOutlookSession (Code) window.
VBA code: Insert date picker in Outlook emails
Sub DatePicker() 'Updated by Extendoffice 20220615 Dim xDoc As Document On Error Resume Next Set xDoc = Application.ActiveInspector.WordEditor With xDoc.Application.Selection .Range.ContentControls.Add (wdContentControlDate) .ParentContentControl.DateDisplayFormat = "MMMM d, yyyy" .InsertAfter Format(Now(), "MMMM d, yyyy") .MoveRight wdCharacter, 1 End With End Sub
Note: In the code, you can change “MMMM d, yyyy” to the date format you need.
3. Stay in the Microsoft Visual Basic for Applications window, click Tools > References.
4. In the References – Project1 dialog box, check the Microsoft Word 16.0 Object Library checkbox, and click OK to save the changes.
5. Press the Alt + Q keys to close the Microsoft Visual Basic for Applications window.
6. In the Mail view, click the New Email button under the Home tab to create a new email.
7. In the Message window, click the Customize Quick Access Toolbar button , and then select More Commands from the drop-down menu. See screenshot:
8. In the Outlook Options window, you need to configure as follows.
The VBA script is now added to the Quick Access Toolbar and displayed as the icon you specified.
From now on, when composing an email, you can click the date picker icon on the Quick Access Toolbar to insert a date picker into the email body, and then select a date you need from it. See the following demo.
Best Office Productivity Tools
Kutools for Outlook - Over 100 Powerful Features to Supercharge Your Outlook
📧 Email Automation: Out of Office (Available for POP and IMAP) / Schedule Send Emails / Auto CC/BCC by Rules When Sending Email / Auto Forward (Advanced Rules) / Auto Add Greeting / Automatically Split Multi-Recipient Emails into Individual Messages ...
Over 100 Features Await Your Exploration! Click Here to Discover More.