Troubleshoot Word for Mac VBA Errors When Linking Endnote References
Question details
The user needs to diagnose a Word for Mac VBA macro that fails while converting endnote references into bookmarked hyperlinks in a document with 918 endnotes.

- Product
- Microsoft Word for Mac
- Device & OS
- Mac; macOS version not provided
- Scenario
- A VBA macro processes hundreds of endnotes, reads a reference field, deletes that field, and replaces it with text as part of hyperlink conversion.
- Observed behavior
- The macro reportedly stops around endnote 117 with run-time error 5941: The requested member of the collection does not exist. The reported code includes .Fields(1).Result and .Fields(1).Delete. It compiles on Windows, but the exact failing statement on the Mac still needs to be confirmed.
Open the affected document in Word for Mac and access the macro through Tools > Macro > Visual Basic Editor. Run diagnostics on a separate test copy because the macro deletes fields and replaces their contents.
Use the VBA debugger to identify the missing collection member
Start here to determine which statement fails and whether the range actually contains the field that the macro expects.
Error 5941 means that the code requested a member that does not exist in the collection being accessed. Fields(1) requires at least one field in the current range; an endnote reference should not automatically be assumed to have that structure.
Successful compilation on Windows does not prove that the macro runs correctly on either platform. A document structure issue, a range-selection issue, or a platform-specific behavior difference must be distinguished through debugging.
Run the macro in Word for Mac. When error 5941 appears, click Debug and record the exact highlighted line, rather than treating the entire reported code block as the failing statement.
In the Visual Basic Editor, locate the With block containing .End = .End + 1 and .Fields(1).Result. If this block targets a Word Range, add Debug.Print .Start, .End, .Fields.Count immediately before the field access. Open View > Immediate Window to read the diagnostic output.
Set a breakpoint by clicking the margin beside .End = .End + 1, then use Debug > Step Into. Compare the range boundaries and field count before and after that statement to verify that the expanded range includes the intended reference.
In the Word document, inspect the endnotes around the reported stopping point, approximately endnote 117. Compare their reference locations and the debugger's field counts with an earlier endnote that processes successfully.

Guard field access and test the conversion in small batches
Use this approach after locating the failure to prevent invalid collection access and isolate references that need different handling.
Use WPS Writer for Everyday Word Document Editing
WPS Office is a free, lightweight alternative with a familiar interface and Microsoft Word format compatibility, making migration straightforward for everyday document work. It does not repair this Word for Mac VBA error; keep the macro diagnosis in Microsoft Word.

Frequently Asked Questions
What does run-time error 5941 mean in this macro?
It means a requested collection member is unavailable. Click Debug when the error appears. If the highlighted statement accesses .Fields(1), check .Fields.Count for that exact range; a count of zero makes the first field unavailable.
Why does the macro fail around endnote 117 when the endnotes look identical?
Similar appearance does not guarantee identical internal structure or range selection. Use Tools > Macro > Visual Basic Editor to log the range boundaries and field count around the stopping point, then compare them with a successful reference.
Does compiling the macro on Windows prove that Mac VBA is the problem?
No. Compilation checks code syntax and references, not whether a field exists when the macro runs. Test equivalent document copies on both platforms and compare the exact failing statement and range contents.
Is checking Fields.Count enough to fix the hyperlink conversion?
It prevents access to Fields(1) when no field exists, but it does not convert skipped references. Add a logged skip path in the VBA editor, then determine whether those references need a corrected range or a different conversion method.
Can WPS Office fix or run this Word for Mac macro?
WPS Office should not be treated as a repair tool or a guaranteed runtime for this Word-specific VBA macro. Use Microsoft Word's Visual Basic Editor for debugging; WPS Writer is an alternative for everyday editing of compatible Word documents.




