Tutorial

Getting Started with Macros

Macro Editor

User Interface

Menus and Toolbar

Editing Macros

Macro Debugging

How To

Using variables

Finding and modifying objects

Creating new page content

Asking for user input

Storing persistent data

Using binary data

Sorting objects

Macro menus

Bulleted and numbered lists

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: September 02, 2024
Also available as a single HTML file

Onetastic Macro Documentation > Functions > Object Functions > InsertObject

InsertObject

Creates a new object and inserts it into OneNote hierarchy or into a OneNote page. Returns the newly created object.

Syntax

Object InsertObject(
	Object object, 
	ObjectType type, 
	Numeric position)

Parameters

Object object
Parent object to insert the new object into.
ObjectType type
The type of the new object to create and insert. Following types of objects can be inserted:
Type Remarks
SectionGroup Can be inserted under a Notebook or a SectionGroup
Section Can be inserted under a Notebook or a SectionGroup
Page Can be inserted under a Section
Outline Can be inserted under a Page
Paragraph Can be inserted under an Outline or a Cell
Table Can be inserted under an Outline or a Cell
Row Can be inserted under a Table
Cell Can be inserted under a Row
Text Can be inserted under a Paragraph
Image Can be inserted under a Page or a Paragraph
EmbeddedFile Can be inserted under a Page or a Paragraph
Tag Can be inserted under a Paragraph, an Image, or an EmbeddedFile
Numeric position
The position of the new object. The value is a 0 based index for the child collection or -1 to insert at the end.

Reference

Statements

Hierarchy Objects

Page Objects

Other Objects

Functions

Array Functions

Color Functions

Data Store Functions

Date/Time Functions

Dialog Box Functions

Macro Execution Functions

Macro Menu Functions

Object Functions

Special Functions

String Functions

Window Functions