SOLIDWORKS VBA Tutorials – SOLIDWORKS tutorials for beginners
Welcome. In this article in our SOLIDWORKS tutorials for beginners series, I’m going to talk about some basics of working with SOLIDWORKS VBA/API, as an introduction to our SOLIDWORKS VBA tutorials. You might be wondering what the heck these terms mean. VBA stands for Visual Basic for Applications. API stands for Application Programming Interface.
Rather than talking about what this is at first, because I know you might just tune it all out, just like Charlie Brown tunes out his adults (“blah blah blah), let’s get right into it. With SOLIDWORKS open, if you go to Tools on the standard menu strip, and scroll down to Macro, then select New. A Save As dialog window opens; once you enter a name and click Save (you can enter your own unique, descriptive name–this is what I recommend) or just accept the default name, Macro1), you’ll be in what’s called the VBA environment. This looks different than SOLIDWORKS, huh? You’ve just entered Visual Basic for Applications. This is based on a Microsoft programming language, Visual Basic.
If you’ve never used VB before, it might seem intimidating, but in reality it’s actually pretty simple once you wrap your mind around the basic concepts. Tremble not; you ain’t gonna be doing any raw programming! You’re just manipulating pre-programmed objects. (For this reason, hard core programmers think Visual Basic isn’t a serious language, but as you can see, if you’re in the VBA for SOLIDWORKS right now, it looks real enough!)
Visual Basic is based on a language called Basic. This is a programming language developed in the 1960s as a kind of learning language. In the 1990s, Microsoft released the first Visual Basic for Applications for Windows-based applications. Today’s Visual Basic doesn’t have much in common with its original Basic language, but Basic is in fact its true foundation.
VBA works for many applications–Inventor, SOLIDWORKS, Microsoft Access, Microsoft Excel and more. This is where you write some code to make custom changes to the application, changes that you can’t make by modifying the pre-programmed options in the Options dialog window of the various software. So, in a nutshell, VBA is where you tweak not your model, but the SOLIDWORKS software itself, to make it work for you even better.
What is so great about VBA? Do you need this if you’re just trying to do design work in SOLIDWORKS? Maybe not, right now. But you’ll find that with a small command of VBA you can create a much more customized environment for your modeling work–something that can help you speed up your work and increase your productivity. For example, you can create your own custom tools, your own custom dialog windows and options boxes etc. Our SolidWorks VBA tutorials teach you about this.
You work in the Visual Basic for Applications in your SOLIDWORKS software, and it connects to the SOLIDWORKS API (the application programming interface) to make the changes you want. This concludes our overview of what VBA means; stay tuned for our next installment of the SOLIDWORKS VBA tutorials for beginners series where we’ll learn about creating and running macros, essentially your building block, a little program that you “write” simply by asking VBA to record your movements on screen. Here’s a link to our SolidWorks VBA tutorials at www.video-tutorials.net:
https://www.video-tutorials.net/shop/solidworks-video-tutorials/solidworks-video-tutorial-api-vba/
Thanks! Rosanna D, VTN www.video-tutorials.net