« Learning Resources for Writing Macros!! | Main | Macro Example – Framed Box »

March 25, 2007

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.

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83451c8df69e200d835781c7e69e2

Listed below are links to weblogs that reference Getting started using the Macro Recorder.:

Comments

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

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

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

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

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)

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)

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment