View Single Post
 
Old 09-17-2022, 07:36 AM
BrianHoard BrianHoard is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jul 2022
Location: Haymarket, VA USA
Posts: 85
BrianHoard is on a distinguished road
Default Comments in Word causing script to crash

I have reduced my script and the attached Word doc to the bare minimum to reproduce this problem.

Starting with a document with a single word and 1 endnote, the following code runs fine:
Code:
ActiveDocument.Range.EndnoteOptions.numberStyle = 0
But, if we add a Word Comment using Review > Comments > New Comment, then run the script, I get the following error:
Run-time error '4605':
This method or property is not available because the object refers to a footnote, endnote, or comment.

In troubleshooting this, sometimes I will not get the error. But if I delete the comment, and then add a new one again, it will give the error again.

I just did another test without any endnotes, and get the error when a comment is added to just a single word in the document.

This is my first experience dealing with Comments, so not sure yet how to work around them in my code.
Attached Files
File Type: docx endnoteComment.docx (19.7 KB, 5 views)
Reply With Quote