Others

Fix Word Run-Time Error 4605 When Copying a Table

Muhammad TalhaMuhammad Talha Nov 18, 2026 868 views

Question details

The user needs a reliable way to duplicate a Word table from a macro without run-time error 4605.

Product
Microsoft Word
Device & OS
not provided
Scenario
A VBA macro copies and pastes a table, potentially when launched from a field below it.
Observed behavior
The macro succeeds during debugging but fails during normal execution with run-time error 4605.
Before you start

Open the document in Word and identify the table to duplicate and the field or location from which the macro runs. Enable macros only if you trust the document and its code.

Solution 1Recommended

Duplicate the Table with Range and FormattedText

Use Word objects instead of selection-based copy and paste to avoid clipboard timing and selection changes.

The example finds the last table before the current selection and inserts a formatted copy after that selection. Place the insertion point below the target table and outside any field before running it. Adapt the table and destination references if the macro must run directly from a field.

1
Open the VBA editor

In Word, open Developer > Visual Basic, then find the macro that currently selects, copies, and pastes the table.

2
Replace the copy and paste code

In the VBA editor, replace the selection-based table-copying block with this code: Dim rng As Range Dim tbl As Table Set rng = ActiveDocument.Range With rng .End = Selection.Range.End If .Tables.Count = 0 Then MsgBox "No table was found before the current selection." Exit Sub End If Set tbl = .Tables(.Tables.Count) .Collapse wdCollapseEnd .InsertAfter vbCr .Collapse wdCollapseEnd .FormattedText = tbl.Range.FormattedText End With

3
Test the macro

Return to the document, click below the table and outside the field, then run the macro from Developer > Macros. Confirm that the copied table appears after the insertion point.

4
Adjust the references if needed

If the macro must run from a field or copy a different table, edit the VBA code to use an explicit Table object and a destination Range instead of relying on the current Selection.

Duplicate the Table with Range and FormattedText
Check the destination: The example uses the current selection to establish the destination; it does not select or copy the table. A protected or otherwise unsuitable destination may still prevent editing.
Free Microsoft Office alternative

Edit Word Tables with WPS Writer

WPS Office is a free, lightweight Office alternative with a familiar interface. Open compatible Word documents in WPS Writer to edit tables and move between Office files more easily. It does not repair Microsoft Word macro errors.

Edit and format document tables in WPS WriterOpen and save compatible Microsoft Word DOC and DOCX filesUse a familiar interface for everyday document workWork with a lightweight Office alternative
microsoft office alternative - wps office

Frequently Asked Questions

Why does the macro work while debugging but fail when run normally?

Stepping through code changes its timing and can mask problems with clipboard operations or the current selection. Using a Range and assigning FormattedText avoids the copy-and-paste sequence.

Which table does the sample macro copy?

It copies the last table found in the document range ending at the current selection. Click below the intended table before running it, or change the code to reference a specific Table object.

Can I run the example directly from a field?

The example depends on the current selection, which may be unsuitable when a field launches the macro. For that workflow, change the code to use explicit table and destination Range references, then test the field action.

Where can I edit the macro in Word?

Open Developer > Visual Basic and locate the macro in the document or its template. If the Developer tab is hidden, enable it through Word's ribbon customization settings.