' ****************************************************************************** '------------------------------------------------------------------ Option Explicit Public Enum swComponentSuppressionState_e swComponentSuppressed = 0 ' Fully suppressed - nothing is loaded swComponentLightweight = 1 ' Featherweight - only graphics data is loaded swComponentFullyResolved = 2 ' Fully resolved - model is completely loaded End Enum Public Enum swSuppressionError_e swSuppressionBadComponent = 0 swSuppressionBadState = 1 swSuppressionChangeOk = 2 swSuppressionChangeFailed = 3 End Enum Sub main() Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swAssy As SldWorks.AssemblyDoc Dim swConf As SldWorks.Configuration Dim swRootComp As SldWorks.Component2 Dim swChildComp As SldWorks.Component2 Dim vChildComp As Variant Dim bRet As Boolean Dim OldPathName As String Dim PathName As String Dim i As Long Dim bRetVal As Boolean Dim nRet As Long Set swApp = CreateObject("SldWorks.Application") Set swModel = swApp.ActiveDoc Set swConf = swModel.GetActiveConfiguration Set swAssy = swModel Set swRootComp = swConf.GetRootComponent vChildComp = swRootComp.GetChildren For i = 0 To UBound(vChildComp) Set swChildComp = vChildComp(i) If swChildComp.GetSuppression = 0 Then OldPathName = swChildComp.GetPathName If OldPathName = "C:\temp\Tauschmich.sldprt" Then bRetVal = True PathName = "C:\temp\IchTauschDich.sldasm" End If If bRetVal Then nRet = swAssy.ReplaceComponents(PathName, "", True, True) swChildComp.SetSuppression2 (2) End If End If Next i End Sub