VBA & Macro Problems

Fix Random Word VBA Paste Errors in VSTO Applications

Kushani NimanthikaKushani Nimanthika Nov 13, 2026 868 views

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.

Fix Random Word VBA Paste Errors in VSTO Applications
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA/VSTO code editor

In your VSTO project or Word VBA editor, locate the procedure that currently calls Range.Copy and Range.Paste.

2
Replace Copy/Paste with FormattedText

Change the clipboard-based assignment to direct assignment, for example: Range2.FormattedText = Range1.FormattedText

3
Run and verify the loop

Run the repeated paste loop and confirm the intermittent "This command is not available" error no longer appears.

Replace Clipboard Copy and Paste with FormattedText Assignment
Clipboard-free formatted copying: Direct FormattedText assignment avoids clipboard command availability issues and keeps formatting intact.
Free Microsoft Office alternative

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. 1. Download WPS Office Free: Visit the official WPS Office website and download the latest installer for Windows.
  2. 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. 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.
Free, lightweight Word-compatible editing without Microsoft VSTO clipboard failures.Opens and saves .docx and .doc files with high compatibility.Familiar ribbon interface helps you migrate from Word quickly.Includes built-in PDF tools and spreadsheet/presentation apps for daily tasks.
microsoft office alternative - wps office

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.