我想要复制页面的说明,例如右键单击页面并移动/复制
OneNote .MergeSections 方法将大致满足您的需要。
尝试在 Excel 中托管这个非常简单的代码片段。
Sub sbMergeSections()
Dim oneNote As New oneNote.Application
oneNote.MergeSections fnGetSectionID("My Check Section"), fnGetSectionID("Next New Section")
End Sub
辅助函数 fnGetSectionID 如下 -
Function fnGetSectionID(sSectionName As String) As String
' This function fnGetSectionID returns the ID of a named section.
' If the named section is not found then the function returns the ID of the first section in the notebook.
Dim oneNote As New oneNote.Application
Dim sSectionsXML As String
oneNote.GetHierarchy "", hsSections, sSectionsXML, xs2013
Dim xDoc As New MSXML2.DOMDocument60
xDoc.LoadXML (sSectionsXML)
Dim nodes As MSXML2.IXMLDOMNodeList
Dim node As MSXML2.IXMLDOMNode
xDoc.SetProperty "SelectionNamespaces", "xmlns:one='http://schemas.microsoft.com/office/onenote/2013/onenote'"
Set nodes = xDoc.DocumentElement.SelectNodes("//one:Section")
For Each node In nodes
If sSectionName = node.Attributes.getNamedItem("name").Text Then
fnGetSectionID = node.Attributes.getNamedItem("ID").Text
Exit Function
Else
' if given section is not found use the first section in the notebook
Dim node0 As MSXML2.IXMLDOMNode
Set node0 = nodes(0)
fnGetSectionID = node0.Attributes.getNamedItem("ID").Text
End If
Next
End Function