AnsweredAssumed Answered

Macro to verify child part metadata

Question asked by Matt Hunter on Mar 28, 2017
Latest reply on Mar 29, 2017 by Deepak Gupta

Hello talented API community,

I am fairly new to working with macros. I recently built a macro designed to validate data cards (at my company we have a lot of metadata that is carried with the part). I have built a function called DataCheck that works incredibly well and I added this bit of code below to allow the user to check all data cards when you have an assembly open. It works rather well currently, but is having issues when I run into subassemblies. It causes a debug error at this line "Set swChildModel = swChildComp.GetModelDoc2".


I have a feeling it finds difficulty with child components of child components. I would love some help as I've stared at this for far too long. If anyone is feeling ambitious... I can certainly add more information.


vChildComp = swModel.GetComponents(False)
    For j = 1 To UBound(vChildComp)

        Set swChildComp = vChildComp(j)
            Set swChildModel = swChildComp.GetModelDoc2
            PartFileName = swChildModel.GetPathName
            Set swConfig = swChildModel.GetActiveConfiguration
            result = DataCheck(PartFileName)
            Next j