Preventing "Command Not Found" errors when changing Word's headers/footers in VBA
I found various threads on the Web from people complaining about Command Not Found errors when using macros that change Word’s headers and footers.
The solution seems to be to repaginate every time you change a header/footer pair. (Of course, it could just be a timing issue, but repaginating does seem to work.)
Here is some example VBA code that sets the headers and footers for all sections to match those of the first:
Without the Repaginate
call on the penultimate line I was getting Command
Not Found errors when setting LinkToPrevious
to True
; with the
repagination, it worked okay.