AnsweredAssumed Answered

Change part configuration in all assembly configurations

Question asked by Chris Griffith on Oct 29, 2019

I have created a macro that allows you to add configurations to different material part files from within an assembly and then changes the part file to the newly created configuration.  However when this is done it only changes the part file in the current assembly configuration.  Here's the code I currently use to change the configuration.

 

Set swApp = Application.SldWorks
Set SwModel = swApp.ActiveDoc
Set swSelMgr = SwModel.SelectionManager

Set swCompModel = swComp.GetModelDoc

objectCount = swSelMgr.GetSelectedObjectCount

For i = 1 To objectCount
Set swComp = swSelMgr.GetSelectedObjectsComponent3(i, 0)

swComp.ReferencedConfiguration = NewConfig

Next

swApp.ActiveDoc.EditRebuild

 

 

My issue is that if there is multiple configurations within the assembly it only changes the current one and then when you go to another configuration the part file changes to a different configuration.

 

Is there any way to use VBA to change the configuration of the part file in all of the assembly configurations?

 

Thanks

Outcomes