VBA & Macro Problems

Fix Word 2016 Runtime Error 4605 in a Mail Merge Macro

Ayan MasoodAyan Masood Nov 25, 2026 869 views

Question details

The user needs to prevent Runtime Error 4605 when a Word 2016 macro copies mail merge content.

Fix Runtime Error 4605 in a Word 2016 Mail Merge Macro
Product
Microsoft Word 2016
Device & OS
not provided
Scenario
A macro creates a new document from a section of a mail merge result.
Observed behavior
Word may display Runtime Error 4605 when the macro uses a method or property that requires a suitable text selection.
Before you start

Open the merged Word document and identify the section your macro should copy. Confirm that you can edit the macro in the VBA editor and run macros permitted by your organization's security settings.

Solution 1Recommended

Copy the Merge Section with a Range Instead of Selection

Use this approach when selection-dependent code triggers Error 4605 while copying a section to a new document.

A Range refers to document content without requiring the macro to select it. The example copies the first section; change the section index to match the content you need.

The example removes the final character from the source range to avoid copying the section break. Copying formatted text alone may not preserve section-level settings, headers, or footers.

1
Open the macro

In Word, open the merged document, then press Alt+F11 and open the relevant module in the VBA editor.

2
Replace selection-based copying

Replace the code that selects and copies the section with a Range-based procedure such as: Sub CopyMergeSection() Dim sourceRange As Range Dim newDoc As Document Set sourceRange = ActiveDocument.Sections(1).Range.Duplicate If sourceRange.End > sourceRange.Start Then sourceRange.End = sourceRange.End - 1 End If Set newDoc = Documents.Add newDoc.Content.FormattedText = sourceRange.FormattedText End Sub

3
Run and check the result

With the merged document active, run CopyMergeSection from the VBA editor or Word's Macros dialog. Check the new document's text and formatting, then save it using File > Save As.

4
Adapt the section index

Change Sections(1) to the section you need, or adapt your existing loop to pass each intended section. Verify the merged document's section structure before assuming that each section represents one recipient.

Copy the Merge Section with a Range Instead of Selection
Check the last section: The last section may end with the document's final paragraph mark rather than a section break. Review the copied content and adjust the range if excluding that character changes the result.
Free Microsoft Office alternative

Work with Word Documents in WPS Writer

WPS Writer is a free, lightweight Office alternative with a familiar interface and support for Word documents, making it easy to move everyday document work to WPS. It does not fix errors in Microsoft Word macros.

Open and edit Microsoft Word DOC and DOCX filesReview and format documents created from mail mergesUse a familiar interface for everyday document editingMove compatible documents to a free, lightweight Office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Word macro show Runtime Error 4605?

The error can occur when a command is unavailable in the current context, such as when code expects selected text. Check the highlighted line in the VBA editor and replace selection-dependent copying with a Range where appropriate.

How do I copy a different section of the merged document?

In the VBA editor, change the index in ActiveDocument.Sections(1).Range to the section you want. Check the merged document first, because its sections do not necessarily correspond one-to-one with recipients.

Will FormattedText copy headers and page setup?

FormattedText copies the range's text and its formatting, but it does not necessarily preserve section-level settings, headers, or footers. Check those items in the new document and handle them separately if needed.

Does WPS Writer fix the macro error in Word 2016?

No. The macro must be corrected in Word. WPS Writer is an alternative for working with compatible Word documents, but macro compatibility should be checked separately.