3 Replies Latest reply on Sep 29, 2017 12:32 PM by Deepak Gupta

    Why does the property Summary Information open when I run a macro with #TASK?

    Elisabeth Daley

      I'm trying to write a simple macro to copy custom properties, and run it using the #TASK application that Deepak Gupta suggested on this thread.  The library macros work great, but when I run the custom one I added, it opens the part and then opens the Properties window, waits until I close it, and then finishes.  How do I keep it from opening the window?  I've tried commenting out literally all of my code, and it still happens.


      For what it's worth, here's what I'm trying to run:


      ' ******************************************************************************

      ' Copy Properties from Workgroup files so PDM datacards work

      ' ******************************************************************************

      Sub main()

          ' Array contains mapping from Workgroup properties to coresponding PDM properties:

          Dim workgroupProps

          Dim PDMprops

          workgroupProps = Array("PartNo", "Description", "ProjectEng", "Author", "DrawnDate", "Description2", "NextAssy", "Project")

          PDMprops = Array("Part Number", "Part Name/Description", "Project Engineer", "Designer", "Date", "NextAssyName", "NextAssyName", "Program")


          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")


          Dim prop As Variant

          Dim textexp As String

          Dim evalval As String

          Dim i As Integer


          i = 0

          For Each prop In workgroupProps

              swCustPropMgr.Get2 prop, textexp, evalval

              'Debug.Print prop & ": " & evalval

              ' if property has value

              If evalval <> "" Then

              ' create corresponding PDM property and assign value

                  swModel.AddCustomInfo2 PDMprops(i), swCustomInfoText, evalval

              End If

              i = i + 1

          Next prop


      End Sub