View Single Post
 
Old 01-02-2023, 12:22 AM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote