05-20-2011, 12:56 PM
I don't have onenote installed on my machine so was not able to test this code...but thought might provide you with a ray of hope.
The line "set oNote = CreateObject("OneNote.Application")" tells use that OneNote does have an Object model but you have to explore more on the methods and properties which it provides.
Do let me know if that helped
Code:
dim oneNote,pageStyle,importedPageID,unfiledPath,unfiledID
set oNote = CreateObject("OneNote.Application")
oNote.GetSpecialLocation 1,unfiledPath
oNote.OpenHierarchy unfiledPath, "", unfiledID, 0
oNote.CreateNewPage unfiledID,importedPageID, 0[/b][/b][/b][/b][/i]
Dim xml2importBase 'As String
xml2importBase = "<?xml version=""1.0""?><one:Section xmlns:one=""http://schemas.microsoft.com/office/onenote/2007/onenote"" ID="""
xml2importBase = xml2importBase + unfiledID + """>"
xml2importBase = xml2importBase + "<one:Page ID=""" + importedPageID + """>"
xml2importBase = xml2importBase + "<one:Title><one:OE><one:T><![CDATA[Title Comes here-2]]></one:T></one:OE></one:Title>"
Dim tailXml
tailXml = "</one:Page></one:Section>"
Dim xml2import
xml2import = xml2importBase + tailXml
oNote.UpdateHierarchy xml2import
oNote.NavigateTo importedPageID, "", False
The line "set oNote = CreateObject("OneNote.Application")" tells use that OneNote does have an Object model but you have to explore more on the methods and properties which it provides.
Do let me know if that helped