Fix Random Word VBA Paste Errors in VSTO Applications
Question details
The user needs a reliable way to copy formatted ranges in Word VBA inside a VSTO application without intermittent "This command is not available" errors during repeated paste operations.

- Product
- Microsoft Word (VSTO application)
- Device & OS
- Windows
- Scenario
- A developer is running a VSTO application that repeatedly pastes formatted ranges through Word VBA.
- Observed behavior
- The paste operation intermittently fails with the Word error "This command is not available", especially during large loops.
Open the problematic VSTO or VBA procedure and identify every Copy/Paste call. Keep the source document active while running the loop so direct range references remain valid.
Replace Clipboard Copy and Paste with FormattedText Assignment
Use this solution when you need reliable formatted range copying in VBA and want to eliminate clipboard or paste-state failures.
Clipboard-based Copy and Paste depends on Word's command availability and can fail during long loops. Assigning FormattedText directly copies formatting and content without invoking the clipboard.
In your VSTO project or Word VBA editor, locate the procedure that currently calls Range.Copy and Range.Paste.
Change the clipboard-based assignment to direct assignment, for example: Range2.FormattedText = Range1.FormattedText
Run the repeated paste loop and confirm the intermittent "This command is not available" error no longer appears.

Use WPS Office as a Lightweight Alternative for Word Editing and Macros
This intermittent paste error is rooted in Microsoft Word's command availability during VSTO clipboard operations, so WPS Office does not patch it. WPS Office is a free, lightweight Office alternative that opens Word documents with a familiar interface and makes migration simple.
- 1. Download WPS Office Free: Visit the official WPS Office website and download the latest installer for Windows.
- 2. Open your Word document in WPS Writer: Launch WPS Writer, click Open, and select the .docx or .doc file you need to edit.
- 3. Rework VSTO-specific automation: Replace the VSTO paste loop with WPS-supported macros or manual formatting workflows to avoid Microsoft Word clipboard command errors.

Frequently Asked Questions
Why does Word VBA show "This command is not available" during repeated pastes?
The error usually occurs when Word's command state is busy or the clipboard is unavailable during a long loop. Using Range2.FormattedText = Range1.FormattedText bypasses Copy and Paste.
Does FormattedText preserve all formatting?
Yes, FormattedText copies the text and its character and paragraph formatting directly from one range to another.
Can I use this fix in a VSTO add-in?
Yes, if your VSTO code is driving Word VBA or the Word object model, replace clipboard calls with FormattedText assignment in the same procedure.
Will WPS Office run VSTO add-ins?
No, VSTO is a Microsoft Office add-in technology. WPS Office is not a drop-in VSTO host, but it opens Word documents and offers a free alternative for everyday editing.
Is there a clipboard-free way to copy formatted ranges in Word?
Yes, use the FormattedText property assignment shown in the recommended solution instead of Copy/Paste.




