What is VBA
VBA stands for Visual Basic for Applications. It is the programming language in which the Microsoft Office applications are written. With VBA, users can make these programs more powerful.
VBA was introduced as a programming language in the mid-1990s. Until then, the languages for the individual Microsoft Office programs were not compatible with one another. However, the applications were to be merged – VBA as a connecting language was born.
Basically, the language allows two approaches: First, smaller automation routines can be written – so-called macros. For example, Word can be instructed to always display the dollar amount in brackets when a euro price appears. Second, even complex applications can be written in VBA, which are still based on the Office programs, but are in fact something fundamentally new. For example, Excel can be instructed to automatically output tables in a specific way.
VBA is compatible with these office solutions
- Word from Word 97
- Access from Access 95
- Excel from Excel 95
- Outlook from Outlook 2000
- Project from Project 2000
- PowerPoint from PowerPoint 2000
- FrontPage from FrontPage 2000
- Visio from Visio 2000
For the Mac, Microsoft ran a zigzag course. The Office versions of the 1990s and early 2000s only offered VBA support. However, in 2008 this was canceled. However, she has been back since 2011. In the meantime, all Office apps have been VBA-based for years. This also applies to other programs such as Corel Draw, MindManager or AutoCAD.
Limits of VBA
VBA is in fact just a lite version of Virtual Basic. For example, it cannot be compiled . VBA also does not make it possible to write executable machine code. In plain language, this means that the programming language must be tied to an environment written in Virtual Basic – such as the individual Office applications. It is said that the language needs “host applications”.
VBA can change functions within these applications, but cannot influence the underlying machine. For example, it is not possible to write code that would instruct Word or Excel to uninstall itself.
Working with VBA, for example, comes up against pragmatic limits in PowerPoint. It would be desirable to write macros that adapt the visual representation of the presentation as optimally as possible to the output device. However, VBA can neither read the information transmitted to the computer, for example from the projector, nor give instructions for changes.
Typical areas of application for VBA
- Functional restrictions of the Office apps on public computers (e.g. no Internet search from a Word document)
- Recurring operations should run automatically (for example, entering sales in an Excel table)
- The appearance of the app should be changed (for example, Excel should always be displayed in full screen when starting)
- Automatic assignment of data (for example in different tables)
- Adopt new functions (text passages from Word are converted into PowerPoint slides, for example)