I'm a total noob at writing code.
I'm trying to write a macro which will do the following:
1.) ensure the check is "on" next to "Show Configuration Names" under Tree Display in the Configuration tab
2.) ensure the check is "on" next to "Show Configuration Descriptions" under Tree Display in the Configuration tab
3.) ensure the check is "on" next to "Numeric" under Tree Order in the Configuration tab
This area is accessed by navigating to the configurations tab in a .sldprt file, then right clicking on the header at the top of the list of configurations.
Here is the code I've written so far (it will turn on the configuration name and configuration description). I just can't get the "Numeric" turned on under Tree Order.
Any help you could provide would be greatly appreciated.
need macro help
need macro help
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim Model As ModelDoc2
Dim ConfigMgr As ConfigurationManager
Dim v As Variant
Dim i As Long
Sub main()
Set swApp = Application.SldWorks
Set Model = swApp.ActiveDoc
Set ConfigMgr = Model.ConfigurationManager
ConfigMgr.ShowConfigurationDescriptions = True
ConfigMgr.ShowConfigurationNames = True
ConfigMgr.SortConfigurationTree swSortType_Numeric
End Sub
Re: need macro help
Does this do what you want? I am on 2022, so I don't have the same options you show.
https://help.solidworks.com/2021/englis ... ple_VB.htm
https://help.solidworks.com/2021/englis ... ple_VB.htm
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
Re: need macro help
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim Model As ModelDoc2
Dim ConfigMgr As ConfigurationManager
Dim v As Variant
Dim i As Long
Sub main()
Set swApp = Application.SldWorks
Set Model = swApp.ActiveDoc
Set ConfigMgr = Model.ConfigurationManager
ConfigMgr.ShowConfigurationDescriptions = True
ConfigMgr.ShowConfigurationNames = True
ConfigMgr.SortConfigurationTree swSortType_Numeric
End Sub
Far too many items in the world are designed, constructed and foisted upon us with no understanding-or even care-for how we will use them.
Re: need macro help
Outstanding! It worked wonderfully. Thanks very much for your help.