There is no need of a macro for that. Use a user-defined variable.
- At the point where you start your agenda, define the initial value of the variable:
-
Insert
>Field
>More Fields
, Variables
tab
-
Type: Set Variable, Name: thedate (this is only an example for the name), Format: Additional formats and choose one of your liking in Date
-
Value: this is tricky to set because it is the number of days since the epoch (1900-01-01)
Roughly, multiply the number of years by 365.25 display the result and adjust to exact date. E.g. today is 2022-12-20 and the corresponding number is 44915.
- To display the next day:
-
Insert
>Field
>More Fields
, Variables
tab
-
Type: Set Variable, Select: thedate (the name you defined above), Format: Additional formats and choose one of your liking in Date
-
Value: thedate+1
You can also increment by another factor: 2 for every other date or 7 for each week; if you have a huge gap, you can also compute the exact number as in the first step to restart a sequence (this may be safer maintenance-wise if you slice your agenda into “chapters”).
Due to a present limitation in Writer (see bug tdf#128041), you can’t insert directly your variable in the page header (it will show the same value everywhere). But there is a workaround.
The date is probably a paragraph on its own in your document. Assign it a Heading n style. Choose the “n” consistently with your structure. It can be 1 if you have no chapters. If your dates are within a chapter (itself at level 1), choose “2”, etc.
- In the header,
Insert
>Field
>More Fields
, Document
tab
-
Type: Chapter, Format: Chapter name, Level: the one you chose for the date
It will show in the header the date of the first paragraph in the page. Symmetrically, you can insert the same field in the footer to show the date of the last paragraph in the page.
In case you want only one date per page, modify the Heading n (the one used to format the dates) Text Flow
tab to automatically insert a page break before the date.