- Print
- DarkLight
- PDF
String Parameter too Long
- Print
- DarkLight
- PDF
Issue
When first merging in a Word document, the following error appears: “Run-time error ‘5854’: String parameter too long.”
Cause of Issue
This error typically indicates that worksheets with range names have been copied into the current workbook. Microsoft Excel copies the path of the source workbook and duplicates all range names. This creates extremely long references that Word is unable to parse.
Solution
To address the issue that causes the following error to appear, “Run-time error ‘5854’: String parameter too long,” follow the steps below.
Check the Name Manager in Excel for external references and delete.
Open the Name Manager in Excel → Formulas Ribbon → Name Manager.
Click to sort by the Refers to column.
Scroll and search for references to a drive, for instance C:\, containing an external file path.
Highlight all external references and delete. Be careful as inadvertent deletion of range names cannot be undone.
Save and Prep the Excel file and attempt the Merge again.
Prevention
Always utilize Merge Workbooks when copying worksheets from another workbook to prevent issues with duplicating range names. This utility was created to workaround Microsoft Excel’s mismanagement of range names.