Hide Table of Contents
ActivateDoc2 Method (ISldWorks)

Obsolete. Superseded by ISldWorks::ActivateDoc3.

.NET Syntax

Visual Basic (Declaration) 
Function ActivateDoc2( _
   ByVal Name As System.String, _
   ByVal Silent As System.Boolean, _
   ByRef Errors As System.Integer _
) As System.Object
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim Name As System.String
Dim Silent As System.Boolean
Dim Errors As System.Integer
Dim value As System.Object
value = instance.ActivateDoc2(Name, Silent, Errors)
System.object ActivateDoc2( 
   System.string Name,
   System.bool Silent,
   out System.int Errors
System.Object^ ActivateDoc2( 
&   System.String^ Name,
&   System.bool Silent,
&   [Out] System.int Errors


Name of document to activate
True if dialogs and warning messages should be avoided, false if dialogs and warning
messages should be displayed to the user
Status of the document activate operation as defined in swActivateDocError_e; if
no errors or warnings are encountered, then this value is set to 0

Return Value

Model document



This file becomes the active document, and this method returns a pointer to that document object.

If you do not specify a file extension in the name parameter, the document activated is based on its name and ignores the file extension. This can cause problems if you have two different document types with the same name loaded; for example, 12345.sldprt and 12345.sldasm.

If you do not specify the filename extension in your call to this method, then you cannot be sure which document is activated. To avoid this problem, you can specify the file name extension in the name parameter or you can check the document type after it is activated using IModelDoc2::GetType.

In some instances, a document requires a rebuild when it is activated. If this is the case and you have passed True for the silent argument, then the activated document is not rebuilt and swDocNeedsRebuildWarning is returned in the errors argument. You can then programmatically rebuild the document using the IModelDoc2::EditRebuild3 method.

If the document needs a rebuild upon activation and you have passed false for the Silent argument, then a dialog is displayed to the users asking them if they want to rebuild the document.

If the user answers...

Then the activated document is...


Not rebuilt and swDocNeedsRebuildWarning is returned in the errors argument.


Rebuilt immediately and this warning is not returned.


See Also


SOLIDWORKS 99, datecode 1999207

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   ActivateDoc2 Method (ISldWorks)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2016 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.