AnsweredAssumed Answered

How to create a macro with advanced selection

Question asked by Mário Nunes on Sep 14, 2020
Latest reply on Sep 15, 2020 by Mário Nunes

How to create a macro with advanced selection?
With category 1 and 2, conditions and value.
The macro I have does not work


Example what I need :

("Document name -- SW Special", Contains, "sldprt")

("Configuration name -- SW Special", Contains, "8419")

("Custom Property", "Custom Property Name", Contains, Value)


Macro I have does not work, don't select anything


Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2

Dim swAssy As SldWorks.AssemblyDoc
Dim swASC As SldWorks.AdvancedSelectionCriteria
Dim swSelMgr As SldWorks.SelectionMgr


Set swApp = Application.SldWorks

Set swSelMgr = swModel.SelectionManager
Set swAssy = swModel
Set swASC = swAssy.GetAdvancedSelection
'swASC.AddItem "Configuration name -- SW Special", SwConst.swAdvSelectType_Contains, "8419", True
'Nome do Ficheiro
swASC.AddItem "Document name -- SW Special", SwConst.swAdvSelectType_Contains, "sldprt", False
End If