5 Replies Latest reply on Jun 12, 2018 11:03 AM by Ivana Kolin

    What is vCustPropNames?

    Keaton Warn

      I am having some issues with vCustPropNames in an array. For some reason it works in some code and not others. However, the main issue right now has to do


      For example, it works fine in the "Find Revision Letter" macro I have attached. It is a modified macro originally written by Keith Rice that exports the custom properties to an Excel spreadsheet. I modified it to find a specific custom property (the Revision custom property present in the company's drawing files) and print it in the Immediate box (ctrl+g).


      I am trying to use a variation of the Find Revision Letter code to extract the revision letter in another macro, attached as Pack and Go Experimental.

      However, the compiler gives me a

                "Compiler error: Variable not defined"

      message if I forget to define "strRevision" as a string in the header.

      If I declare it as a string, I get a

                "Run-time error '91': Object variable or With block variable not set"

      message from the Set swCustPropMgr = swModel.Extension.CustomPropertyManager("") line. This is weird because this line is before the offending strRevision line. Shouldn't this line error out before the strRevision line, regardless of if the strRevision is decalred or not?


      If I remove the Set swCustomPropMgr = swModel.Extension.CustomPropertyManager("") line, I get array errors in the ReDim lines and tend to have a lot of issues with vCustPropNames.

        • Re: What is vCustPropNames?
          Ivana Kolin

          one macro has 'Option Explicit' which is definitely better.


          add this to sub main

          Dim vCustPropNames As Variant

          Dim i As Integer

            • Re: What is vCustPropNames?
              Keaton Warn

              Dim vCustPropnames As Variant is already in the Pack and Go Experimental file.

              Dim i As Long is already in the Pack and Go Experimental file.

              However, they are not in the Find Revision Letter macro.


              Find Revision Letter Macro:

              If I add "Option Explicit" to Find Revision Letter, I get a "Variable Not Defined" error. When I make the declarations you suggested, it works again.


              Pack and Go Experimental

              This macro gets stuck on the "Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")" line when it is set up like the Find Revision Letter macro above. Why does it do this?


              Unselecting "SOLIDWORKS Utilities 2015 Type Library" doesn't do anything for the Pack and Go Experimental macro.


              Pack and Go Experimental References:


              Find Revision Letter References: