Hide Table of Contents
ReplaceReferencedDocument Method (ISldWorks)

Replaces a referenced document.

.NET Syntax

Visual Basic (Declaration) 
Function ReplaceReferencedDocument( _
   ByVal ReferencingDocument As System.String, _
   ByVal ReferencedDocument As System.String, _
   ByVal NewReference As System.String _
) As System.Boolean
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim ReferencingDocument As System.String
Dim ReferencedDocument As System.String
Dim NewReference As System.String
Dim value As System.Boolean
value = instance.ReplaceReferencedDocument(ReferencingDocument, ReferencedDocument, NewReference)
System.bool ReplaceReferencedDocument( 
   System.string ReferencingDocument,
   System.string ReferencedDocument,
   System.string NewReference
System.bool ReplaceReferencedDocument( 
&   System.String^ ReferencingDocument,
&   System.String^ ReferencedDocument,
&   System.String^ NewReference



Document whose references to modify; the document cannot be open


Document is referenced by ReferencingDocument; all of its references within ReferencingDocument are replaced by NewReference


New document used by ReferencingDocument

Return Value

True if the the referenced document is replaced, false if not



Mates, dimensions, and other references might fail when the referencingDocument is opened.

If the internal ID of the ReferencedDocument does not match the internal ID of the NewReference document, then an error message is displayed when the ReferencingDocument is opened. The internal ID is a time stamp that was generated when the file was created. Unless the NewReference is actually a renamed copy of the ReferencedDocument document, then it is unlikely that the internal IDs will match.

This method does not check for the existence of the NewReference document. If the document does not exist when the ReferencingDocument is opened, then the user is warned and prompted to browse for a replacement.

The ReferencedDocument and NewReference file types must match. For example, if ReferencingDocument is an assembly with four subassemblies, you cannot replace any of the subassembly references with a part document. If you were to replace any of the subassembly references, they would need to be replaced by another SOLIDWORKS assembly document.

You might also notice that the component name, which is visible in the FeatureManager design tree, will not change to the name of the NewReference unless the proper user preference is set (Tools, Options, System Options, External References, Update component names when documents are replaced).


See Also

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:   ReplaceReferencedDocument 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) 2015 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.