24 Replies Latest reply on Jan 11, 2019 11:52 AM by Todd Blacksher

    Pulling Material Information from a Custom Material Library

    Todd Blacksher

      Good Afternoon All,


      Let me start by saying that my API/macro knowledge is severely lacking, which has “inspired me" to start learning a little more.


      Here’s the situation:

      I’m at a new job, and I’m looking at an old macro that was put in place by someone about 11 years ago, and they are no longer here.

      I have been told that it only works on two of the older computers (we’re all using the same version of SOLIDWORKS & Windows.)


      I tried the macro from the network location on my new machine, and received this error message:

      This is the portion that is highlighted when VBA opens:


      After a little digging on the forums, I found this:

      a user-defined type not defined !


      I checked my references, and SOLIDWORKS Utilities 2015 Type Library was not checked.

      I checked the box, but it would not stay on the next time I ran the macro.)

      (Since the macro on the network is “Read Only”, I copied it to my desktop, and it kept the reference change.)


      This is what my “Available References:” now looks like:

      Since I am still getting the same error, I started looking into the highlighted section of the macro from the image above.


      This forum thread contained an almost identical section of code that is being used in our macro:

      Get Material Properties from Material Library


      As of right now, I am not able to share the macro, I am hoping that will change soon.

      In the meantime, I am still doing a lot of digging, and I thought that I would throw it out to see if there is something very basic that I might be overlooking.


      The next aspect that I am reviewing is the Material Library – We are using (and referring to) a custom material library.

      It is listed in the File Locations under Material Databases (along with the other (3) that cannot be deleted.)

      Like I said, I will share more information as soon as possible, I just wanted to get a better set of eyes on this while I continue to find out how much I don’t know about macros!


      Thanks all,