How to Enter Time as hh:mm:ss Without Typing Colons in Word
Question details
The user needs a way to enter time into a Word document or form field in the hh:mm:ss format without having to manually type the colons.

- Product
- Word Processor
- Device & OS
- not provided
- Scenario
- Filling out form fields or quickly logging time records within a document.
- Observed behavior
- Standard document form fields do not automatically convert a continuous number string (like 051732) into a properly colon-separated time format (05:17:32).
Ensure that the Developer tab is enabled in your word processor's ribbon so you can access the VBA editor to create and run macros.
Use a VBA Macro to Insert Formatted Time as Text
Since native form fields do not auto-format strings into times with colons, you can use a short VBA macro to insert the current time directly in the correct HH:mm:ss format.
This approach utilizes a simple script that grabs the system's current time and inserts it at your cursor's location. Because it is inserted as plain text, you can easily edit the time after insertion if needed.
Press ALT + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
In the VBA editor menu, click on 'Insert' and select 'Module' to create a blank workspace for your code.
Copy and paste the following code into the module window: Sub InsertTimeM() Selection.TypeText Format(Now, "HH:mm:ss") End Sub
Close the VBA editor. Place your cursor where you want the time to appear in the document, go to the Developer tab, click 'Macros', select 'InsertTimeM', and click 'Run'.

Automate Your Workflow with WPS Writer
WPS Writer offers an intuitive interface and excellent compatibility for handling form fields and advanced document automation. You can easily manage text formatting, use templates, and speed up repetitive tasks.
- 1. Open WPS Writer: Launch WPS Office and open your document in WPS Writer.
- 2. Access Developer Tools: Go to the options menu to enable the Developer tab on your ribbon.
- 3. Utilize Macro Features: Use the built-in macro tools (available in advanced versions) to paste your VBA script for time insertion.
- 4. Execute the Task: Run the script to automatically insert perfectly formatted hh:mm:ss time fields without typing colons.

Frequently Asked Questions
Can I format an existing number string like 051732 into a time format without using VBA?
Standard word processors do not have a built-in mask to automatically convert a 6-digit number string into a time format with colons. You either have to type the colons manually or use a VBA macro to handle the formatting.
How do I assign this time-insertion macro to a keyboard shortcut?
Go to File > Options > Customize Ribbon > Keyboard shortcuts. In the categories list, scroll down and select 'Macros', find your 'InsertTimeM' macro, press a new shortcut key combination (like Ctrl+Shift+T), and click Assign.
Will the time inserted by this macro update automatically like a clock?
No. The 'Selection.TypeText' method inserts the time as static text. It will remain exactly as the time it was when you ran the macro. If you need it to be modified, you can simply backspace and edit it like regular text.




