Getting started using the Macro Recorder.
When I first write a macro, it is for a specific function that meets a specific need. Itâs short, sweet, to the point, and gets the job done. Nothing more, nothing less. This is what you get when you use the macro recorder.
If you are unsure how to begin writing the macro, you can use the macro recorder to record the steps you want your macro to do. To use the macro recorder, start it from the macro toolbar, then complete the steps you want the macro to follow. When you are done, stop the recorder and save the macro. Once the macro is saved, you can play (launch) the macro and watch the macro do the work you just recorded. Each time you run the macro it will complete the same steps every time.
You can also load the recorded macro into the macro editor and look at the Visual Basic (VB) code and Application Programming Interface (API) calls that are necessary to repeat the tasks that were recorded. This new macro can then be modified to meet a variety of needs. You can allow user input via a form and provide additional features and improved functionality to suit your current and future needs.
When you are learning how to write macros, start the macro recorder and do something you usually do, or something you want to learn how to do with a macro. Save the macro then load it into the VB editor and see how it works. Remember, this is a learning experience and the best way to learn is to explore what you donât already know.
As time permits, I may add some macro examples to this area of my blog.

Hi Lenny,
Your blog is very interesting. But, i don't find on the net a macro that give in the property of a part "surface area" in sqr feet. I want to put automatically in a drawing the surface to paint.
Do you know if it's possible. I will appreciate.
Thanks
Regis
Posted by: Regis | February 21, 2008 at 10:56 AM
I have not seen any downloadable macro to do this for you.
There is an example "How to calculate the surface area of a model, including reference surfaces" API on SolidWorks website at "http://www.solidworks.com/pages/services/CodeExamples.html" that you may be able to use and modify to meet your needs.
Lenny
Posted by: Lenny Kikstra | February 21, 2008 at 12:29 PM
hi lenny
I downloaded your macro for assembly bom which is very good. I want to list material properties in the bom, but in the properties dialogue I use the value based on the material from the part, so on the bom I get "SW-Material@???.SLDPRT". Is there a way to overcome this?
Regards
Mario Jaconelli
Posted by: Mario Jaconelli | May 01, 2008 at 03:27 PM
hey sorry i'm newb on using the macro I download the "How to calculate the surface area of a model, including reference surfaces" but when I go to edit makro and copy paste the code it didnt generate anything, can u explain some more? I dont know how to use it? thx
Posted by: Andry | October 06, 2008 at 06:22 PM
I’m trying to get overall blank size from SW but it looks that SW does not have that kind of option
I believe that only macro can do it means calculate it from flatblank view SW generates for drawing purpose the problem is I do not know api do Y have any hint for this?
I mean not real blank size (area) but area for material req to make part (with scrap)
Posted by: ed | February 06, 2009 at 04:03 PM
I’m trying to get overall blank size from SW but it looks that SW does not have that kind of option
I believe that only macro can do it means calculate it from flatblank view SW generates for drawing purpose the problem is I do not know api do Y have any hint for this?
I mean not real blank size (area) but area for material req to make part (with scrap)
Posted by: ed | February 06, 2009 at 04:03 PM