4 Replies Latest reply on Oct 22, 2014 10:03 AM by Alexander Sandstrom

    Warning for Object Not Found

    Alexander Sandstrom

      I'm working on a Macro to automate updating multiple design tables within an assembly at once. The assembly is based off of the customer part that is placed within the assembly. The first design table that gets updated is that of the customer part but, in order to update it, the name needs to be changed within the macro. In order to make sure that any of the engineers in my company can run the macro properly, I would like to warn the user if the part is not found (example: macro set to update design table for "Part1" but "Part 2" replaced "Part1"). Now the link between the part and macro is broken until the user edits the macro to use "Part2" in place of "Part1". How can I incorporate a warning to the user that tells them to update the macro if "Part1" is not found? Thanks in advance.

       

      Macro:

          'Update Customer Part

          boolstatus = Part.Extension.SelectByID2("Part1@Untitled", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)

          Part.OpenCompFile

          Set Part = swApp.ActiveDoc

          swApp.ActivateDoc2 "Part1.SLDPRT", False, longstatus

          Set Part = swApp.ActiveDoc

          boolstatus = Part.Extension.SelectByID2("Design Table", "DESIGNTABLE", 0, 0, 0, False, 0, Nothing, 0)

          Part.InsertFamilyTableEdit

          Part.CloseFamilyTable

          Set Part = Nothing

          swApp.ActivateDoc2 "Untitled.SLDASM", False, longstatus

          Set Part = swApp.ActiveDoc