Fix Word Runtime Error 4605 When Pasting from Excel
Question details
The user needs to prevent intermittent runtime error 4605 when an Excel-to-Word macro pastes Clipboard content during batch processing.

- Product
- Microsoft Word and Microsoft Excel VBA automation
- Device & OS
- not provided
- Scenario
- A macro copies Excel content and pastes it into multiple Word documents.
- Observed behavior
- Word intermittently reports that the Clipboard is empty or invalid when the macro attempts to paste.
Locate the Excel copy statement and the Word range or selection used for the paste in your VBA macro. Confirm that the source range contains the intended content and that the target Word document is open.
Retry the Word paste operation after allowing the Clipboard to settle
Use a bounded retry when error 4605 occurs intermittently because copied Excel content is not ready to paste.
The helper below retries error 4605 up to 20 times, allowing other events to run between attempts. It reports other errors immediately instead of hiding them.
In Excel, press Alt+F11 and open the module containing the automation macro.
Add this procedure to the module: Private Sub PasteWithRetry(ByVal target As Object) Dim attempt As Long, errNum As Long Dim errText As String Dim started As Single, elapsed As Single For attempt = 1 To 20 On Error Resume Next Err.Clear target.Paste errNum = Err.Number errText = Err.Description On Error GoTo 0 If errNum = 0 Then Exit Sub If errNum <> 4605 Then Err.Raise errNum, "PasteWithRetry", errText started = Timer Do DoEvents elapsed = Timer - started If elapsed < 0 Then elapsed = elapsed + 86400 Loop While elapsed < 0.25 Next attempt Err.Raise 4605, "PasteWithRetry", "Word could not paste after 20 attempts." End Sub
In the macro, keep the Excel range's Copy action immediately before the paste, then replace the Word range's Paste call with PasteWithRetry CNameRange, or pass the Word range your macro uses as the target.
Run the macro from Excel and check several generated Word documents. If it still stops after the retries, verify the copy source and target range rather than extending the loop indefinitely.

Check the Word target and release automation objects
Use these checks if the batch fails at a bookmark or continues to fail after adding paste retries.
Work with Excel and Word files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for opening and editing spreadsheets and documents. Its Microsoft Office format support helps you move existing files into WPS, though it does not repair Microsoft Word's runtime error or guarantee VBA macro compatibility.

Frequently Asked Questions
Why does error 4605 happen only on some files?
Clipboard availability can vary during batch processing, so Word may reach Paste before the copied content is ready. Check the Excel Copy statement and use a bounded retry around the Word paste.
Does DoEvents alone guarantee that the paste will work?
No. DoEvents lets other events run, but it does not guarantee that Clipboard content is ready. Retry the paste for a limited time and report the error if it still fails.
What should I check if the macro fails at CountryName?
Check wdDoc.Bookmarks.Exists("CountryName") before retrieving the target range, and verify that the bookmark exists in each document or template. This failure may be separate from error 4605.
Can WPS Office fix error 4605 in my Microsoft Word macro?
No. The error occurs in Microsoft Word automation. WPS Office can open and edit compatible DOCX and XLSX files as an alternative, but existing VBA automation should be tested separately for compatibility.




