We know about the problems with Doug's code, which is why I've posted
four different macros for you to try. It appears you've only ever tried the first one. The code in post #15 (
https://www.msofficeforums.com/word/...html#post28578), especially, shouldn't generate any of those errors.
Of course, without knowing exactly what's in your endnotes, it's possible the error is because there's, say, a frame in one of them - as suggested by the error message.