Add VBA as a Macro Language for OneNote Desktop
I would find it useful to write VBA to automate certain tasks without using OneNote API. I know VBA and could interoperate Office applications easily if VBA could automate OneNote. I do not know the OneNote API; learning it would be a significant learning curve. Why should OneNote be any different than the rest of the Office offerings?
OneNote Windows Desktop has supported VBA for many versions now. https://msdn.microsoft.com/en-us/library/office/jj680118.aspx
Claus Persson commented
Would very much like VBA in OneNote to automate tasks and help my teams to perform better.
I can't fix MS. However, Omer Atay was a developer on the OneNote team, and he created Onetastic in his free time.
Your link is to pages describing the C# API, not the VBA examples.
Not only should Microsoft include a VBA editor for OneNote, they should include a Macro Recorder (like Word and Excel have) as well. In fact, they should have Macro Recorder for *all* their products, including Windows itself (and Windows phone, which will give that platform an advantage over iOS and Android).
I completely agree. Come on, Microsoft! If you want to be #1, then keep doing what has made you great all along with Office.
Andrew Wynn commented
I think that rather than write a full suite of code to parse the bits of XML that are returned by the API functions, so we can identify Notebook/SectionGroup/Section/Page then retrieve some data, (because as far as I can see, there is no API function that allows us to change data. The closest thing I can see is CreatePage. No Idea where CreateSection, Notebook, SectionGroup are though) we should just be able to load the VBE and write some code quickly, like in other office applications.
I came across this post because I have a printout with 50 pages, and I have what they should be called in an excel document. This should be as simple as:
Dim ONpage as OneNote.Page
Dim ONsec as OneNote.Section
Dim i as Long
For each ONPage in ONSec
ONPage.Title = Range("A" & i).value
Admittedly, that's bad code, but you get the idea. This should be a simple API, or there should be a VBA editor attached to OneNote.
Additionally, the examples on Microsoft's own website don't work with OneNote 2016, unless the notebook was created in OneNote 2016 (something about a problem with the namespace in the XML)