How to Use VBA to Always Paste Unformatted Text in a Word Template
Question details
The user needs to force the paste command to always insert unformatted plain text exclusively in documents based on a specific template.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Creating a customized template where formatting consistency is required, meaning any text pasted by users must strip its original formatting.
- Observed behavior
- Because the application lacks a built-in Document_Selection_Paste event to natively handle this restriction, the default paste behavior brings in unwanted external formatting.
Ensure the Developer tab is enabled in your ribbon to access the VBA editor, and save your file as a Macro-Enabled Template (.dotm) to retain the code.
Intercept the Built-in Paste Command with the EditPaste Macro
Create a macro named EditPaste stored inside your specific template. This intercepts the default paste action and converts it to a plain-text paste.
By naming a macro exactly 'EditPaste', you override the application's built-in paste command. Storing it in a specific template rather than the global Normal.dotm ensures it only affects documents created from that template.
Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
In the Project Explorer panel, locate your specific template file. Right-click it, select 'Insert', and choose 'Module'.
In the code window, enter the following code: Sub EditPaste() Selection.PasteSpecial DataType:=wdPasteText End Sub
Save the template as a Macro-Enabled Template (.dotm) and close the editor. Create a new document from this template and test the paste command (Ctrl + V) to verify text is pasted unformatted.

Assign Unformatted Paste to a Custom Shortcut
If you do not want to override the default Ctrl+V behavior entirely, you can create a custom macro and assign it to a new shortcut or ribbon button.
Streamline Your Workflow with Macros in WPS Writer
WPS Writer provides robust support for VBA macros in its advanced editions, allowing you to seamlessly run customized paste commands like EditPaste. With high compatibility, you can manage and execute your Microsoft Word templates flawlessly.
- 1. Download and Install WPS Office: Download the latest version of WPS Office and install it on your device.
- 2. Open Your Template: Open your macro-enabled template directly in WPS Writer.
- 3. Enable Macros: Navigate to the Developer tab, enable macros, and run or edit your VBA scripts identically to how you would in other major office suites.

Frequently Asked Questions
Why is there no Document_Selection_Paste event?
The application's object model does not expose a native event strictly for intercepting a paste action. Intercepting core application commands requires overriding the command by name (like EditPaste) rather than using an event listener.
Will the EditPaste macro affect my other documents?
No, provided you save the macro specifically within your custom template (.dotm). It will only override the paste command for documents that are generated from or currently attached to that specific template.
Can I change the global paste options instead of using VBA?
Yes, you can change the default paste format to 'Keep Text Only' in the application's Advanced Options. However, this global setting will apply to all open documents and all future documents, rather than being restricted to just one template.




