[1][2] VBA is used for professional and end-user development due to its perceived ease-of-use, Office's vast installed userbase, and extensive legacy in business.
It supersedes and expands on the abilities of earlier application-specific macro programming languages such as Word's WordBASIC.
VBA can use, but not create, ActiveX/COM DLLs, and later versions add support for class modules.
VBA is also implemented, at least partially, in applications published by companies other than Microsoft, including ArcGIS, AutoCAD, Collabora Online, CorelDraw, Kingsoft Office, LibreOffice,[3] SolidWorks,[4] WordPerfect, and UNICOM System Architect (which supports VBA 7.1).
When personal computers were initially released in the 1970s and 1980s, they typically included a version of BASIC so that customers could write their own programs.
In 1989, Bill Gates sketched out Microsoft's plans to use BASIC as a universal language to embellish or alter the performance of a range of software applications on microcomputers.
Until that time, each Microsoft application had its own macro language or automation technique, and the tools were largely incompatible.
This spurred the development of numerous custom business applications, and the decision was made to release VBA in a range of products.
Code written in VBA is compiled[6] to Microsoft P-Code (pseudo-code), a proprietary intermediate language, which the host applications (Access, Excel, Word, Outlook, and PowerPoint) store as a separate stream in COM Structured Storage files (e.g., .doc or .xls) independent of the document streams.
This documentation can be examined from inside the VBA development environment using its Object Browser.
As an example, VBA code written in Microsoft Access can establish references to the Excel, Word and Outlook libraries; this allows creating an application that – for instance – runs a query in Access, exports the results to Excel and analyzes them, and then formats the output as tables in a Word document or sends them as an Outlook email.
VBA programs can be attached to a menu button, a macro, a keyboard shortcut, or an OLE/COM event, such as the opening of a document in the application.
The language provides a user interface in the form of UserForms, which can host ActiveX controls for added functionality.
Inter-process communication automation includes the Dynamic Data Exchange (DDE) and RealTimeData (RTD) which allows calling a Component Object Model (COM) automation server for dynamic or realtime financial or scientific data.
[7] As with any common programming language, VBA macros can be created with malicious intent.
In February 2022, Microsoft announced its plan to block VBA macros in files downloaded from the Internet by default in a variety of Office apps due to their widespread use to spread malware.
[8] A risk with using VBA macros, such as in Microsoft Office applications, is exposure to viruses.
[9][10] Risks stem from factors including ease of writing macros which decreases the skill required the write a malicious macro and that typical document sharing practices allow for a virus to spread quickly.
This allows for significant flexibility, but also is a risk that hackers can exploit to access the document and its host computer without the user's knowledge or consent.
For example, a hacker could replace the built-in core functionality macros such as AutoExec, AutoNew, AutoClose, AutoOpen, AutoExit with malicious versions.
[11] A malicious macro could be configured to run when the user presses a common keyboard shortcut such as Ctrl+B which is normally for bold font.
[10]: 609–610 Polymorphic viruses change their code in fundamental ways with each replication in order to avoid detection by anti-virus scanners.
[10]: 605 So, like the heuristic analysis, this can lead to false positives errors, due to the fact that this type of anti-virus checks the whole document.
However, VSA was deprecated in version 2.0 of the .NET Framework,[19] leaving no clear upgrade path for applications desiring Active Scripting support (although "scripts" can be created in C#, VBScript, and other .NET languages, which can be compiled and executed at run-time via libraries installed as part of the standard .NET runtime).
[22][23] With Office 2010, Microsoft introduced VBA7, which contains a true pointer data type: LongPtr.
The 64-bit install of Office 2010 does not support common controls of MSComCtl (TabStrip, Toolbar, StatusBar, ProgressBar, TreeView, ListViews, ImageList, Slider, ImageComboBox) or MSComCt2 (Animation, UpDown, MonthView, DateTimePicker, FlatScrollBar), so legacy 32-bit code ported to 64-bit VBA code that depends on these common controls will not function.