What does Visual Basic do?

An explanation of how Microsoft's Visual Basic for Applications works. June 13, 2001

Question
I have written 20 or so parametric macros for certain part creations using AlphaCAM and they are great. I have no vb knowledge and would like a good description of how they work and what they can do that I can't do now.

Forum Responses
Microsoft's Visual Basic for Applications® (VBA) is the world's most widely used Rapid Applications Development Language. It is built into all Microsoft Office® programs as well as many hundreds of others, covering a wide range of applications, including AutoCAD. VBA works with the core code of software programs into which it is incorporated through an Application Programming Interface (API).

VBA provides two fundamental functions for host programs. First, it enables customization of host programs to enable users to automate processes within such programs and to make them function in a particular way. This functionality is comparable to but very much more powerful than the legacy ‘parametric macro’ function that exists in AlphaCAM. Parametric macros simply use the menu structure to link a series of commands to produce a desired result, allowing for user input during the process. When first offered, this functionality was revolutionary and provided a much-appreciated resource for AlphaCAM. But time has moved on, and VBA now facilitates much greater power and versatility for users. Licom was the first CAD/CAM developer to incorporate VBA and an associated API, and has exposed most of its core functions through that API. Skilled programmers can now do extraordinarily complex things to build on the inherent power of AlphaCAM. But it is not necessary to be a professional programmer to use VBA in AlphaCAM. There is a growing body of users among our many thousands of AlphaCAM enthusiasts around the world who are taking advantage of this power, and either writing fresh VBA macros or converting old parametric macros to VBA format and enhancing their functionality and speed by doing so.

The second advantage of VBA is that it allows full-scale integration between software programs and their data. This means that AlphaCAM is able to work with data from and provide data to external applications such as spreadsheets, databases, cost estimating, and accounting software. The ability to integrate means that order entry systems, inventory management systems, part labeling and bar-coding systems can all work with AlphaCAM. There is now virtually no limit other than the imagination and inventiveness of users as to what can be achieved in this way.

Licom offers an Introduction to VBA training course at our Charlotte Headquarters. We do not, however, attempt to provide comprehensive VBA training since that is not our business and there are many local sources of such training. VBA is now taught in most high schools and colleges and there are many thousands of VBA programmers with the skill to capitalize on what is available in AlphaCAM.



VB/VBA allows you to move data between different programs without manual intervention. VB/VBA also allows the data to be manipulated or stored in a manner that can easily be read or printed for reports.

For example, if you have a process that requires many keystrokes, the keystrokes and the likelihood of mistakes can be eliminated by using a VB/VBA macro, as opposed to doing the same operation over and over manually.

You can also export data from AutoCAD to an Excel spreadsheet to allow parametric functions to be used within Excel, take that data and print a cutlist, then export the data back into AutoCAD and print drawings to be submitted for approval for a job. Many manual tasks are eliminated as well as the chances to make mistakes.

Most current engineering packages allow you to interface fairly easily with VB/VBA.

Just about any of the larger bookstore chains will have books on VB/VBA programming. If there is a community college close by that you have easy access to, they will have courses from entry level on up. Most of the Microsoft certification schools offer venues to teach as well.