Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

What do you do after recording a macro? 1

Status
Not open for further replies.

CMcF

Mechanical
May 28, 2003
149
What do you do after recording a macro? I press play and nothing happens. Please help someone who wants to learn how to use vba.
 
Replies continue below

Recommended for you

My only exposure to Macros has been assigning simple macros to tool bar buttons. It was important to save the macro in a folder in the same folder as Solidworks.exe. If you didn't then the Macro wouldn't run.
 
EUANS,
your right. Thank you.
 
Unfortunately, the macro recorder is not always reliable. This is typically used as a basis for starting a macro or finding code for a specific action. You will need to learn more about the object library if you wish to do things that are not recordable. If you have any specific questions, please ask. There are plenty of members with a great deal of knowledge in this area.

DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
dsi,
thanks for your generous offer, can you suggest a starting point for learning about the object library? SW help, Tutorials, books?
 
As far as the macro, there are some things a macro does not record, like keystrokes. Open the macro ("Tools --> Macro --> Edit") and see what was recorded. Look up the commands in the API help.

As far as learning programming, pick up some books. I bought VBA for Dummies and Visual Basic Weekend Crash Course from Barnes and Noble. Those taught me the basics of object oriented programming and VB.

The trickiest part of programming in SW is learning what the different object types can do. Many have values that are accessed by methods that one would think could be accessed by properties.

[bat]Good and evil: wrap them up and disguise it as people.[bat]
 
TheTick is right on. If you are just starting VB, pick up the books he suggested. Once you are familiar with the concepts, you should be able to pick up the SolidWorks objects much easier. Some VARs actually offer API classes. I helped teach one that included the basics of VBA programming as well as the SolidWorks API. SolidWorks does have a training manual for their API, but I am not sure if you can get that directly from SolidWorks, or if it's only available through your VAR. It also includes a CD with plenty of samples.

DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
another thing to keep in mind is that the macro, as recorded, really isnt parametric, and does one specific task.

Since that task was already done when you first *recorded* the macro, re-running it may do nothing because the task has already been done.
 
Thank you people, I shall be buying the books. I look forward to giving you more interesting challenges in the future!
 
CMcF,
With help from dsi and others, I have saved our company $1000’s. Our title block is filled in automatically. The revisions are done through Visual Basic 6.0. Setting the revisions for our drawings, models and assemblies is a bit tricky, so Visual Basic helps set them. To get some quick ideas as to what can be done check out: and check out Joe Jones’ Macros/Examples. Don’t give up, the hours you put in now will save many hours in the future. Start with something small and easy and go from there.

Bradley
 
Bradley
Thanks for the encouragement. I have some experience of automating CAD with ME10. I look forward to doing the same and more with SW. Thanks for the link.
Colin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor