How to Add Current Date and Time to Word Content Controls
Question details
The user wants a date picker content control to automatically insert both the current date and time when clicked, and needs to resolve an 'Ambiguous name detected' VBA compile error.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Creating an interactive document (like a Bingo card) where clicking a box must log the exact current time instead of defaulting to 12:00 AM.
- Observed behavior
- The date picker defaults to 12:00 AM instead of the current time, and a compile error 'Ambiguous name detected: Document_ContentControlOnEnter' prevents the VBA macro from running.
Ensure you have the Developer tab enabled in your Word ribbon and make a backup copy of your document before editing VBA macros.
Configure Content Control and Fix the VBA Macro
Set up a Date Picker Content Control with the correct format, remove duplicate VBA event procedures causing the compile error, and apply the macro code to capture the exact time.
By default, standard Date Picker controls do not capture the exact time, resetting it to 12:00 AM. Using a VBA event procedure allows you to dynamically populate the control with the current date and time using the 'Now' function.
The compile error 'Ambiguous name detected' occurs when multiple procedures share the exact same name within the module. Removing the duplicate code will restore macro functionality.
If you cannot see the Developer tab, go to Word Options > Customize Ribbon, check the box next to 'Developer', and click OK.
Navigate to the Developer tab, click the 'Date Picker Content Control' icon to insert it. Then, click 'Properties' in the Developer ribbon and choose a format from 'Display the date like this' that includes both date and time.
Press Alt+F11 on your keyboard to open the Visual Basic for Applications (VBA) editor. In the Project Explorer pane on the left, double-click 'ThisDocument'.
Scan the code window for multiple instances of 'Private Sub Document_ContentControlOnEnter'. Delete the duplicates so that only one procedure with this name remains, which fixes the 'Ambiguous name detected' error.
Ensure your single 'Document_ContentControlOnEnter' procedure is programmed to insert the 'Now' function when the control still displays its placeholder text.
Go to File > Save As and change the file type to 'Word Macro-Enabled Document (*.docm)' or 'Word Macro-Enabled Template (*.dotm)'. Macros will not run if saved as a standard .docx file.

Try WPS Office for a Seamless Document Experience
If you frequently struggle with complex VBA macros, compile errors, or rigid formatting in Microsoft Word, WPS Office provides a lightweight, highly compatible, and user-friendly alternative. It handles professional document editing with ease while remaining free and accessible.

Frequently Asked Questions
Why does my Word date picker always show 12:00 AM?
This happens because the standard Date Picker Content Control only captures the calendar date, leaving the time field at its default 12:00 AM. To capture the precise time of a click, you must run a VBA macro using the 'Now' function.
What does 'Ambiguous name detected' mean in Word VBA?
This compile error indicates that two or more procedures (macros) in the same module share the exact same name, such as multiple 'Document_ContentControlOnEnter' events. To resolve it, you must delete or merge the duplicate procedures.
Can I save my VBA macros in a standard Word document?
No, standard Word documents (.docx) cannot store VBA macros for security reasons. You must save your document as a Macro-Enabled Document (.docm) or Macro-Enabled Template (.dotm) for the code to function.




