What is the best VBA method for counting up all configuration in an active document (part or asm) and returning value in message box?
Can someone share VBA code?
Here is a cheap & dirty one..
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Set swApp = SolidWorks.SldWorks
Set swModel = swApp.ActiveDoc
MsgBox "Configuration Count: " & swModel.GetConfigurationCount
I think this might work:
2017 SOLIDWORKS API Help - IGetConfigurationNames Method (ISldWorks)
i thinks its this:
2018 SOLIDWORKS API Help - GetConfigurationCount Method (IModelDoc)
but i dont want VB...I need a VBA macro
What code do you have already?
nothing to show
You will need something close to this.
Dim swApp As Sldworks.Sldworks
Dim swModel As Sldworks.Modeldoc2
Dim ConfigCount As Long
Set swApp = GetObject(, "SldWorks.Application")
Set swModel = swApp.ActivateDoc
ConfigCount = swModel.GetConfigurationCount
MsgBox("The number of configurations are " & cstr(ConfigCount))
thats exactly what i was hoping for, thank you for sharing!
Retrieving data ...