That's awful code and I'd be surprised if it would work at all. Amongst other things it has a quite invalid 'With ActiveSheet' reference. Word documents don't have worksheets.
In any case, what you're doing requires no code and can be done via the use of an Excel workbook with a column of dates for the year (1 January 2023 in A2, then increment the value by 1 on each successive row) and connecting your existing document to that workbook for a letter-type mailmerge and an appropriate mergefield wherever you want the date to appear on the first page. With 365 data rows in your Excel workbook, finish the merge and you'll automatically get a 365-page document, each page having its own date.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
|