Diary Pages

Description : Create Group Section ( Diary 2017)->Create month TAB ( January )->Macro will create diary pages for a given month

Download

Author(s) : Omer Atay, write2deepaks
Category : Pages
Last Updated : February 20, 2017
Requirements : OneNote 2010 or above
Screenshot :

Diary Pages

Select Year
Select Month
Changelog :

February 20, 2017 (CE05B8) - Omer Atay
Created date for the pages are now set to the same date as in the page title

December 25, 2016 (3C5DDA) - Omer Atay
Fixed an issue where the day of the week would be incorrect

December 13, 2016 (BCD005) - write2deepaks
Initial version

Comments

Name
Comment
JW - 2020-01-02
I found that it wasn't helpful to have the year included, or day of the week at the end, so I made a couple tweaks that I thought I'd share. I couldn't get them to work as three separate lines-- not sure why, but my solution did get my desired result. The page names now appear as Mon 6-Jan, Fri 17-Jan, etc.

In the editor, if you expand the code snip While($i <= $Days) --the last section in the macro--, you'll find a section with While (Array_Length($ParagraphObjects_5) 0)

I combined three of these elements and I rearranged the order to get the page name that I wanted.
The elements I replaced were:
$ParagraphObject_4.text = (((($i + "-") + $Month) + "-") + $Year)
$ParagraphObject_4.text += " "
$ParagraphObject_4.text += ($DayNames[((($i - 1) + $Start) % 7)] + " ")

I deleted them all (Unfortunately I couldn't get them to just comment out :/) and replaced them with the below, which removes the year and some spaces, along with moving day of the week to the front.

$ParagraphObject_4.text += (($DayNames[((($i - 1) + $Start) % 7)] + " ") + (($i + "-") + $Month))

Note, though, that I also changed the months and days arrays to be only three characters for brevity. The above will only remove the year from the page name, but will display the Month and Day of week as it is displayed in your code.
pyXelr - 2020-01-01
Instruction for those who want to update the macro to include the next years (you can do it with the Free license):

1) Open OneNote and inside the "Home" toolbar menu open "Edit Macros" > "Diary Pages".

2) Edit 11th line of the code with the years you wish. For example:
DialogBox_AddDropDown($dialog_box, "Select &Year", "Year", $year, Array(2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032))

3) Edit 18th line of the code (the "If") line with the leap years. For example:
If (((($Month != "January") && ($Month != "February")) && (((($Year == 2016) || ($Year == 2020)) || ($Year == 2024)) || ($Year == 2028))) || ($Year == 2032))

4) Unroll the code under "If $Month == "February" and add the leap years, just like in the 3rd step. For example:
If ((((($Year == 2016) || ($Year == 2020)) || ($Year == 2024)) || ($Year == 2028)) || ($Year == 2032))
pyXelr - 2018-12-31
Hello Developers,

First of all thank you for this macro, as I tend to use it for the 3rd year of daily notes.

Second of all, do you have any plans of extending the date range above 2020?