ArcObjects Library Reference (Framework)  

IApplication.NewDocument Method

Creates a new document in this application.

[Visual Basic .NET]
Public Sub NewDocument ( _
    [ByVal selectTemplate As Boolean], _
    [ByVal templatePath As String] _
)
[C#]
public void NewDocument (
    bool selectTemplate,
    string templatePath
);
[C#]

Optional Values

selectTemplate   Supply false as a default value.
templatePath   Optional, default value of .

Product Availability

Available with ArcGIS Desktop.

Description

selectTemplate Specify True if you want the New document dialog to be opened to allow the user to select a template. [Optional]

templatePath is a string representing the path and filename of the template to base the new document on if selectTemplate is False. [Optional]

Remarks

If selectTemplate is True, the New document dialog is displayed.

If templatePath is not specified, the New document dialog is displayed regardless of the value of selectTemplate.

Note, this method does not work in ArcCatalog.

The following example creates a new document in ArcMap using the Normal template. You would get m_app from the hook in ICommand::OnCreate().

[C#]

// Get the path and filename of the Normal template
ITemplates pTemplates = m_app.Templates;
string normalPath = pTemplates.get_Item(0);

//Create a new document based on Normal
m_app.NewDocument(false, normalPath);

[Visual Basic .NET]

' Get the path and filename of the Normal template
Dim pTemplates As ITemplates = m_app.Templates
Dim normalPath As String = pTemplates.get_Item(0)

'Create a new document based on Normal
m_app.NewDocument(False, normalPath)

See Also

IApplication Interface