API: How to replace an assembly component with a component from a different path (VBA, VB.NET, C#)

File uploaded by Joyce Bossom Employee on Dec 13, 2010Last modified by Joyce Bossom Employee on Feb 4, 2013
Version 4Show Document
  • View in full screen mode

This example shows how to replace a component in an assembly.


  1. Unpack the archive in a convenient location.
  2. Open an assembly in SolidWorks.
  3. Select a component to replace in the assembly.
  4. Edit the macro (VBA, VB.NET, or C#) in the Macro Editor.
  5. Change sFileName to point to the path of a replacement component that does not have the same name as the selected component.
  6. Run the macro.


The specified external component replaces the selected component in the assembly.


- Subscription Services required for full access.

- Looking for more API Examples?


Copyright © 2011 Dassault Systèmes SolidWorks Corp. All rights reserved.
Do not distribute or reproduce without the written consent of Dassault Systèmes SolidWorks Corp.