Hide Table of Contents
CloseAndReopen Method (ISldWorks)

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

.NET Syntax

Visual Basic (Declaration) 
Function CloseAndReopen( _
   ByVal Doc As ModelDoc2, _
   ByVal Option As System.Integer, _
   ByRef NewDoc As ModelDoc2 _
) As System.Integer
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim Doc As ModelDoc2
Dim Option As System.Integer
Dim NewDoc As ModelDoc2
Dim value As System.Integer
value = instance.CloseAndReopen(Doc, Option, NewDoc)
System.int CloseAndReopen( 
   ModelDoc2 Doc,
   System.int Option,
   out ModelDoc2 NewDoc
System.int CloseAndReopen( 
&   ModelDoc2^ Doc,
&   System.int Option,
&   [Out] ModelDoc2^ 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


Download Close and Reopen a Drawing Document (VBA, VB.NET, C#) from the SOLIDWORKS API forum. You must be a SOLIDWORKS subscription customer to access the SOLIDWORKS API forum's documents.


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 2012 FCS, Revision Number 20.0

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:   CloseAndReopen 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.