Hi All,
I hope there is someone that can help me out with this. Hopefully it will help others with the same problem.
I am learning how to create my own Solidworks Features, and I have come across a great example to create a Multi-BossExtrude macro.
Here is the URL: https://www.codestack.net/solidworks-api/document/macro-feature/multi-extrude/
They also provide an example SolidPart to use it on. See link for example SLDPRT (I cannot attach it for some reason)
So I create the Macro structure exactly as they do in the example, and IT WORKS! But ONLY with the sample SolidPart that they provide in the link above.
If I create a solidworks part (sketchs) similar to their example part, I get a "User-defined type not defined" error when I try run the Macro (See Attached).
Now why does it work with their example model, and not with a model that I create my self?
FYI. I say model, however, essencially its just 3 sketchs, each sketch on different planes, just like they do in the example model.
Please can someone help, as this is stopping me from learning this awesome feature :)
Regards
Scott

Hey Scott,
Have you added the 'SolidWorks 20xx exposed type libraries for add-in use' reference to your macro? This is the first thing that comes to mind.
From the SW API Help:
"To use this interface:
In a SOLIDWORKS VBA macro, you must reference the SOLIDWORKS exposed type libraries for add-in use type library specific to the version of SOLIDWORKS that you are running."
https://help.solidworks.com/2021/english/api/swpublishedapi/SOLIDWORKS.Interop.swpublished~SOLIDWORKS.Interop.swpublished.IPropertyManagerPage2Handler9.html
@SB, Austin is correct, you need to add this type library (I have updated this macro at CodeStack to mention this explicitly in the article).
If you are planning to use the macro feature I would recommend trying the COM-based macro features in .NET (C# or VB.NET). This will allow you to build robust features. You can use xCAD.NET framework which makes it much easier to build macro features: https://xcad.xarial.com/custom-features/
Take a look at this video from my presentation at 3D Experience World in 2020 which demonstrates how to build macro feature from scratch (9:30 mark, but you can see the full video as it also shows how to create add-in): https://www.youtube.com/watch?v=BuiFfv7-Qig&t=570s