Hide Table of Contents
CloseAndReopen2 Method (ISldWorks)

Closes and reopens the specified drawing document without unloading its references from memory.

.NET Syntax

Visual Basic (Declaration) 
Function CloseAndReopen2( _
   ByVal Doc As System.Object, _
   ByVal Option As System.Integer, _
   ByRef NewDoc As System.Object _
) As System.Integer
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim Doc As System.Object
Dim Option As System.Integer
Dim NewDoc As System.Object
Dim value As System.Integer
value = instance.CloseAndReopen2(Doc, Option, NewDoc)
System.int CloseAndReopen2( 
   System.object Doc,
   System.int Option,
   out System.object NewDoc
System.int CloseAndReopen2( 
&   System.Object^ Doc,
&   System.int Option,
&   [Out] System.Object^ NewDoc


IModelDoc2; drawing document to close and reopen
Reopen options as defined in swCloseReopenOption_e
IModelDoc2; reopened drawing document

Return Value

Error code as defined in swCloseReopenError_e


Contact SOLIDWORKS API Support to obtain Close and Reopen a Drawing Document (VBA, VB.NET, CSolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISldWorks~CloseAndReopen2.html#).


Before a third-party application can process a drawing document that is open in SOLIDWORKS, it must close the document. Usually when a drawing document is closed, its references are unloaded from memory, and reopening the drawing document takes a lot of time. This method closes a drawing document, keeps its references in memory, and quickly reopens it.

After the drawing document is closed and before it is reopened, SOLIDWORKS fires a FileCloseNotify event with reason swFileCloseNotifyReason_e.swFileCloseNotifyReason_CloseForReload. In the handler of this event, a third-party application can call ISldWorks::SetPromptFileName2 to open a different file, or it can process the specified document before it is reopened in SOLIDWORKS.

See IModelDoc2::ReloadOrReplace to perform a similar function with part and assembly documents.


See Also


SOLIDWORKS 2022 FCS, Revision Number 30

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:   CloseAndReopen2 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) 2022 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.