Visual Basic for Applications (VBA) is an implementation of
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
's event-driven programming language
Visual Basic 6.0 built into most desktop
Microsoft Office
Microsoft Office, MS Office, or simply Office, is an office suite and family of client software, server software, and services developed by Microsoft. The first version of the Office suite, announced by Bill Gates on August 1, 1988, at CO ...
applications. Although based on pre-.NET Visual Basic, which is no longer supported or updated by Microsoft (except under Microsoft's "It Just Works" support which is for the full lifetime of supported Windows versions, including Windows 10 and Windows 11), the VBA implementation in Office continues to be updated to support new Office features. VBA is used for professional and
end-user development End-user development (EUD) or end-user programming (EUP) refers to activities and tools that allow end-users – people who are not professional software developers – to program computers. People who are not professional developers can use EUD to ...
due to its perceived ease-of-use, Office's vast installed userbase, and extensive legacy in business.
Visual Basic for Applications enables building
user-defined function A user-defined function (UDF) is a function provided by the user of a program or environment, in a context where the usual assumption is that functions are built into the program or environment. UDFs are usually written for the requirement of its c ...
s (UDFs), automating processes and accessing
Windows API
The Windows API, informally WinAPI, is the foundational application programming interface (API) that allows a computer program to access the features of the Microsoft Windows operating system in which the program is running. Programs can acces ...
and other low-level functionality through
dynamic-link libraries (DLLs). It supersedes and expands on the abilities of earlier application-specific
macro programming languages such as
Word's WordBASIC
WordBASIC was a subset of Microsoft QuickBASIC customized for word-processing in Microsoft Word. It was replaced by Visual Basic for Applications (VBA) when Word 97 was released. Contrarily to VBA, WordBasic was not object-oriented
Object-o ...
. It can be used to control many aspects of the host application, including manipulating user interface features, such as menus and toolbars, and working with custom user forms or dialog boxes.
As its name suggests, VBA is closely related to Visual Basic and uses the Visual Basic Runtime Library. However, VBA code normally can only run within a host application, rather than as a
standalone program
A standalone program, also known as a freestanding program, is a computer program that does not load any external module, library function or program and that is designed to boot with the bootstrap procedure of the target processor – it runs o ...
. VBA can, however, control one application from another using
OLE Automation
In Microsoft Windows applications programming, OLE Automation (later renamed to simply Automation) is an inter-process communication mechanism created by Microsoft. It is based on a subset of Component Object Model (COM) that was intended for use ...
. For example, VBA can automatically create a
Microsoft Word
Microsoft Word is a word processor program, word processing program developed by Microsoft. It was first released on October 25, 1983, under the name Multi-Tool Word for Xenix systems. Subsequent versions were later written for several other platf ...
report from
Microsoft Excel
Microsoft Excel is a spreadsheet editor developed by Microsoft for Microsoft Windows, Windows, macOS, Android (operating system), Android, iOS and iPadOS. It features calculation or computation capabilities, graphing tools, pivot tables, and a ...
data that Excel collects automatically from polled sensors. VBA can use, but not create,
ActiveX/COM DLLs, and later versions add support for class modules.
VBA is built into most
Microsoft Office
Microsoft Office, MS Office, or simply Office, is an office suite and family of client software, server software, and services developed by Microsoft. The first version of the Office suite, announced by Bill Gates on August 1, 1988, at CO ...
applications, including Office for Mac OS X (except version 2008), and other Microsoft applications, including
Microsoft MapPoint
Microsoft MapPoint is a discontinued software program and service created by Microsoft that allows users to view, edit and integrate maps. The software and technology are designed to facilitate the geographical visualization and analysis of eithe ...
and
Microsoft Visio
Microsoft Visio (, ), formerly Microsoft Office Visio, is a diagramming and vector graphics application and is part of the Microsoft 365 Business. The product was first introduced in 1992 by former American software company Visio Corporation, an ...
. VBA is also implemented, at least partially, in applications published by companies other than Microsoft, including
ArcGIS
ArcGIS is a family of client, server and online geographic information system (GIS) software developed and maintained by Esri.
ArcGIS was first released in 1982 as ARC/INFO, a command line-based GIS. ARC/INFO was later merged into ArcGIS De ...
,
AutoCAD
AutoCAD is a 2D and
3D computer-aided design (CAD) software application developed by Autodesk. It was first released in December 1982 for the CP/M and IBM PC platforms as a desktop app running on microcomputers with internal graphics control ...
,
Collabora Online
Collabora Online is an open source online office suite based on LibreOffice, enabling web-based collaborative real-time editing of word processing documents, spreadsheets, presentations, and vector graphics. Optional apps are available for deskto ...
,
CorelDraw
CorelDRAW is a vector graphics editor developed and marketed by Alludo (formerly Corel Corporation). It is also the name of the Corel graphics suite, which includes the bitmap-image editor Corel Photo-Paint as well as other graphics-related progr ...
,
Kingsoft Office,
LibreOffice
LibreOffice () is a free and open-source office productivity software suite developed by The Document Foundation (TDF). It was created in 2010 as a fork of OpenOffice.org, itself a successor to StarOffice. The suite includes applications ...
,
SolidWorks
SolidWorks (stylized as SOLIDWORKS) is a brand of software used for solid modeling computer-aided design (CAD) and computer-aided engineering (CAE). It was one of the first 3D CAD applications designed to run on a desktop PC.
The brand is owned ...
,
WordPerfect
WordPerfect (WP) is a word processing application, now owned by Alludo, with a long history on multiple personal computer platforms. At the height of its popularity in the 1980s and early 1990s, it was the market leader of word processors, disp ...
, and UNICOM
System Architect (which supports VBA 7.1).
Origins
When personal computers were initially released in the 1970s and 1980s, they typically included a version of
BASIC
Basic or BASIC may refer to:
Science and technology
* BASIC, a computer programming language
* Basic (chemistry), having the properties of a base
* Basic access authentication, in HTTP
Entertainment
* Basic (film), ''Basic'' (film), a 2003 film
...
so that customers could write their own programs. Microsoft's first products were BASIC compilers and interpreters, and the company distributed versions of BASIC with
MS-DOS
MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few op ...
(versions 1.0 through 6.0) and developed follow-on products that offered more features and capabilities (
QuickBASIC
Microsoft QuickBASIC (also QB) is an Integrated Development Environment (or IDE) and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was also a short-lived version for the c ...
and BASIC Professional Development System).
In 1989,
Bill Gates
William Henry Gates III (born October 28, 1955) is an American businessman and philanthropist. A pioneer of the microcomputer revolution of the 1970s and 1980s, he co-founded the software company Microsoft in 1975 with his childhood friend ...
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. He also revealed that the installed base of active BASIC programmers was four million users, and that BASIC was used three times more frequently than any other language on PCs.
When Visual Basic was released in 1991, it seemed logical to use Visual Basic as the universal programming language for Windows applications. Until that time, each Microsoft application had its own macro language or automation technique, and the tools were largely incompatible. The first Microsoft application to debut VBA was Microsoft Excel 5.0 in 1993, based on Microsoft Visual Basic 3.0. This spurred the development of numerous custom business applications, and the decision was made to release VBA in a range of products.
Windows users learned about the changes through user groups, books, and magazines. Early computer books that introduced VBA programming skills include Reed Jacobsen's ''Microsoft Excel Visual Basic for Windows 95 Step by Step'' (Microsoft Press, 1995) and
Michael Halvorson
Michael James Halvorson (born 1 March 1963) is an American technology writer and historian. He was employed at Microsoft, Microsoft Corporation from 1985 to 1993 and contributed to the growth of the Microsoft Office and Visual Basic (classic), Micr ...
and Chris Kinata's ''Microsoft Word 97 Visual Basic Step by Step'' (Microsoft Press, 1997).
Design
Code written in VBA is
compiled to
Microsoft P-Code (pseudo-code), a proprietary
intermediate language
An intermediate representation (IR) is the data structure or code used internally by a compiler or virtual machine to represent source code. An IR is designed to be conducive to further processing, such as optimization and translation. A "good" ...
, which the host applications (
Access
Access may refer to:
Companies and organizations
* ACCESS (Australia), an Australian youth network
* Access (credit card), a former credit card in the United Kingdom
* Access Co., a Japanese software company
* Access International Advisors, a hed ...
,
Excel,
Word
A word is a basic element of language that carries semantics, meaning, can be used on its own, and is uninterruptible. Despite the fact that language speakers often have an intuitive grasp of what a word is, there is no consensus among linguist ...
,
Outlook
Outlook or The Outlook may refer to:
Computing
* Microsoft Outlook, also referred to as ''the classic Outlook'' an e-mail client and personal information management software product from Microsoft
* Outlook for Windows, also referred to as ''the ...
, and
PowerPoint) store as a separate
stream
A stream is a continuous body of water, body of surface water Current (stream), flowing within the stream bed, bed and bank (geography), banks of a channel (geography), channel. Depending on its location or certain characteristics, a strea ...
in
COM Structured Storage
COM Structured Storage (variously also known as '' COM structured storage'' or ''OLE structured storage'') is a technology developed by Microsoft as part of its Windows operating system for storing hierarchical data within a single file. Strictl ...
files (e.g.,
.doc
or
.xls
) independent of the document streams. The intermediate code is then executed
by a
virtual machine
In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
(hosted by the host application). Compatibility ends with Visual Basic version 6; VBA is incompatible with
Visual Basic .NET
Visual Basic (VB), originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language developed by Microsoft and implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the ...
(VB.NET). VBA is proprietary to Microsoft and, apart from the COM interface, is not an
open standard
An open standard is a standard that is openly accessible and usable by anyone. It is also a common prerequisite that open standards use an open license that provides for extensibility. Typically, anybody can participate in their development due to ...
.
Automation
Interaction with the host application uses
OLE Automation
In Microsoft Windows applications programming, OLE Automation (later renamed to simply Automation) is an inter-process communication mechanism created by Microsoft. It is based on a subset of Component Object Model (COM) that was intended for use ...
. Typically, the host application provides a
type
Type may refer to:
Science and technology Computing
* Typing, producing text via a keyboard, typewriter, etc.
* Data type, collection of values used for computations.
* File type
* TYPE (DOS command), a command to display contents of a file.
* ...
library and
application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
(API) documentation which document how VBA programs can interact with the application. This documentation can be examined from inside the VBA development environment using its Object Browser.
Visual Basic for Applications programs which are written to use the OLE Automation interface of one application cannot be used to automate a different application, even if that application hosts the Visual Basic runtime, because the OLE Automation interfaces will be different. For example, a VBA program written to automate Microsoft Word cannot be used with a different word processor, even if that word processor hosts VBA.
Conversely, multiple applications can be automated from the one host by creating Application objects within the VBA code. References to the different libraries must be created within the VBA client before any of the methods, objects, etc. become available to use in the application. This is achieved through what is referred to as Early or Late Binding. These application objects create the OLE link to the application when they are first created. Commands to the different applications must be done explicitly through these application objects in order to work correctly.
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
In computing, a keyboard shortcut (also hotkey/hot key or key binding) is a software-based assignment of an action to one or more keys on a computer keyboard. Most Operating system, operating systems and Application software, applications come ...
, 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
ActiveX is a deprecated software framework created by Microsoft that adapts its earlier Component Object Model (COM) and Object Linking and Embedding (OLE) technologies for content downloaded from a network, particularly from the World Wide W ...
controls for added functionality.
Inter-process communication
In computer science, interprocess communication (IPC) is the sharing of data between running Process (computing), processes in a computer system. Mechanisms for IPC may be provided by an operating system. Applications which use IPC are often cat ...
automation includes the
Dynamic Data Exchange (DDE) and
RealTimeData (RTD) which allows calling a
Component Object Model
Component Object Model (COM) is a binary-interface technology for software components from Microsoft that enables using objects in a language-neutral way between different programming languages, programming contexts, processes and machines ...
(COM) automation server for dynamic or realtime financial or scientific data.
Security concerns
As with any common programming language, VBA macros can be created with malicious intent. Using VBA, most of the
security
Security is protection from, or resilience against, potential harm (or other unwanted coercion). Beneficiaries (technically referents) of security may be persons and social groups, objects and institutions, ecosystems, or any other entity or ...
features lie in the hands of the user, not the author. The VBA host application options are accessible to the user. The user who runs any document containing VBA macros can preset the software with user preferences.
End-user
In product development, an end user (sometimes end-user) is a person who ultimately uses or is intended to ultimately use a product. The end user stands in contrast to users who support or maintain the product, such as sysops, system administrato ...
s can protect themselves from attack by disabling macros from running in an application or by granting permission for a document to run VBA code only if they are sure that the source of the document can be trusted.
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.
Macro risks
A risk with using VBA macros, such as in
Microsoft Office
Microsoft Office, MS Office, or simply Office, is an office suite and family of client software, server software, and services developed by Microsoft. The first version of the Office suite, announced by Bill Gates on August 1, 1988, at CO ...
applications, is exposure to viruses.
[
] 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.
;System macro virus
A system macro one that provides a core operation can be redefined. 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.
A malicious macro could be configured to run when the user presses a common keyboard shortcut such as which is normally for bold font.
;Document-to-macro conversion
A type of macro virus that cuts and pastes the text of a document in the macro. The macro could be invoked with the Auto-open macro so that the text would be re-created when the document (empty) is opened. The user will not notice that the document is empty. The macro could also convert only some parts of the text in order to be less noticeable. Removing macros from the document manually or by using an anti-virus program could lead to a loss of content in the document.
;Polymorphic macros
''
Polymorphic viruses change their code in fundamental ways with each replication in order to avoid detection by anti-virus scanners.''
In
WordBasic
WordBASIC was a subset of Microsoft QuickBASIC customized for word-processing in Microsoft Word. It was replaced by Visual Basic for Applications (VBA) when Word 97 was released. Contrarily to VBA, WordBasic was not object-oriented
Object-o ...
(first name of the language
Visual Basic Visual Basic is a name for a family of programming languages from Microsoft. It may refer to:
* Visual Basic (.NET), the current version of Visual Basic launched in 2002 which runs on .NET
* Visual Basic (classic), the original Visual Basic suppo ...
),
polymorphic viruses are difficult to do.
Indeed, the macro's
polymorphism relies of the
encryption
In Cryptography law, cryptography, encryption (more specifically, Code, encoding) is the process of transforming information in a way that, ideally, only authorized parties can decode. This process converts the original representation of the inf ...
of the document. However, the hackers have no control of the
encryption key
A key in cryptography is a piece of information, usually a string of numbers or letters that are stored in a file, which, when processed through a cryptographic algorithm, can encode or decode cryptographic data. Based on the used method, the key ...
.
Furthermore, the encryption is inefficient: the encrypted macros are just in the document, so the encryption key is too and when a
polymorphic macro replicates itself, the key does not change (the replication affects only the macro not the encryption).
In addition to these difficulties, a macro can not modify itself, but another macro can. WordBasic is a powerful language, it allows some operations to the macros:
* Rename the variables used in the macro(s).
* Insert random comments between the operators of its macro(s)
* Insert between the operators of its macros other, ‘do-nothing’ WordBasic operators which do not affect the execution of the virus.
* Replace some of its operators with others, equivalent ones, which perform the same function.
* Swap around any operators the order of which does not impact the result of the macro’s execution.
* Rename the macro(s) themselves to new, randomly selected names each time the virus replicates itself to a new document, with the appropriate changes in these parts of the virus body which refer to these macros.
So, in order to implement macros viruses which can change its contents, hackers have to create another macro which fulfills the task to modify the content of the virus. However, this type of macro viruses is not widespread. Indeed, hackers frequently choose to do macro viruses because they are easy and quick to implement. Making a
polymorphic macro requires a lot of knowledge of the WordBasic language (it needs the advanced functionalities) and more time than a "classic" macro virus. Even if a hacker were to make a polymorphic macro, the
polymorphism needs to be done, so, the document needs to update and the update can be visible to a user.
;Chained macros
During replication, a macro can create do-nothing macros. But this idea can be combined with polymorphic macros, so macros are not necessarily do-nothing; each macro invokes the next one, so they can be arranged in a chain. In such a case, if they are not all removed during a disinfection, some destructive payload is activated. Such an attack can crash the winword processor with an internal error. Since
Winword 6.0, the number of macros per template is limited to 150, so the attack is limited, too, but can still be very annoying.
;"Mating" macro viruses
Macro viruses can, in some cases, interact between themselves. If two viruses are executed at the same time, both of them can modify the source code of each other.
So, it results a new virus which can not be recognize by the anti-viruses software. But the result is totally random: the macro virus can be more infectious or less infectious, depending upon which part of the virus has been changed.
However, when the 'mating' is unintentional, the resulting macro virus has more chances to be less infectious.
Indeed, in order to replicate itself, it has to know the commands in the source code, but, if it is changed with a random scheme, the macro can not replicate itself.
Nevertheless, it is possible to do such macros intentionally (it is different from polymorphic macros viruses which must use another macro to change their contents) in order to increase the infectivity of the two viruses.
In the example of the article,
the macro virus ''Colors
'' infected a document, but another infected the user's system before : the macro virus ''Concept''.
Both of these viruses use the command ''AutoOpen'', so, at first, the macro virus ''Colors'' was detected but the command ''AutoOpen'' in it was the command of the macro virus ''Concept''.
Moreover, when ''Concept'' duplicates itself, it is unencrypted, but the command in the virus ''Colors'' was encrypted (Colors encrypt its commands).
So, replication of the macro virus ''Concept'' results in the hybridation of this macro virus (which had infected the user's system first) and ''Colors''.
The "hybrid" could replicate itself only if ''AutoOpen'' were not executed; indeed this command comes from ''Concept'', but the body of the hybrid is ''Colors'', so that create some conflicts.
This example shows the potential of mating macro viruses: if a couple of mating macro viruses is created, it will make it more difficult to detect both macro viruses (in this hypothesis, there are only two viruses which mate) by the
virus-specific scanners and may reinforce the virility of the viruses.
Fortunately, this type of macro virus is rare (more than the polymorphic macro viruses, one may not even exist), indeed, creating two (or more) which can interact with each other and not reduce the virility (rather reinforce it) is complicated.
;Macro virus mutators
Among the worst scenarios in the world of viruses would be a tool allowing one to create a new virus by modifying an existing one.
For executable files, it is hard to create this kind of tool. But it is very simple for macro viruses since sources of macros are always available. Based on the same idea of polymorphic macros, a macro can perform modifications to all macros present in the document. Considering this, there are just a few modifications to make to the macro in order to convert it in a macro virus mutator.
So it is easy to create macro virus generators, and thereby to create quickly several thousands of known viruses.
;Parasitic macro viruses
Most macros viruses are stand-alone; they do not depend on other macros (for the infectious part of the virus, not for the replication for some viruses), but some macros viruses do. They are called parasitic macros.
When launched, they check other macros (viruses or not), and append their contents to them. In this way, all of the macros became viruses.
But, this type of macro can not be spread as quickly as stand-alone macros.
Indeed, it depends on other macros, so, without them, the virus can not be spread. So, parasitic macros often are hybrid: they are stand alone and they can infect other macros.
This kind of macro virus poses real problems to the
virus-specific anti-virus; in fact, they change the content of other viruses, so that accurate detection is not possible.
Suboptimal anti-virus
There are different types of anti-virus (or scanners), one is the
heuristic analysis anti-virus which interprets or emulates macros.
Indeed, to examine all branches of macros require a
NP-complete
In computational complexity theory, NP-complete problems are the hardest of the problems to which ''solutions'' can be verified ''quickly''.
Somewhat more precisely, a problem is NP-complete when:
# It is a decision problem, meaning that for any ...
complexity
(using
backtracking
Backtracking is a class of algorithms for finding solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solutions, and abandons a candidate ("backtracks") as soon as it de ...
), so in this case, the analysis of one document (which contains macros) would take too much time. Interpreting or emulating a macro would lead to either
false positive
A false positive is an error in binary classification in which a test result incorrectly indicates the presence of a condition (such as a disease when the disease is not present), while a false negative is the opposite error, where the test resu ...
errors or in macro viruses not detected.
Another type of anti-virus, the
integrity checker
File verification is the process of using an algorithm for verifying the integrity of a computer file, usually by checksum. This can be done by comparing two files bit-by-bit, but requires two copies of the same file, and may miss systematic corr ...
anti-virus, in some cases, does not work: it only checks documents with extensions DOT or
DOC
DOC, Doc, doc or DoC may refer to:
People and characters
* Doc, an abbreviation of doctor
* Doc (nickname)
* Doc (mascot), the Towson University mascot
Persons
* The D.O.C., American rapper (born 1968)
* Doc Gallows (born 1983), ring nam ...
(indeed, some anti-virus producers suggest to their users), but Word documents can reside in others extensions than those two, and the content of the document tends to change often.
So, like the
heuristic analysis, this can lead to
false positives
A false positive is an error in binary classification in which a test result incorrectly indicates the presence of a condition (such as a disease when the disease is not present), while a false negative is the opposite error, where the test res ...
errors, due to the fact that this type of anti-virus checks the whole document.
The last type of anti-virus seen will be the
virus-specific scanner.
It searches the signature of viruses, so, the type of anti-virus is weaker than the previous ones.
Indeed, the viruses detected by
virus-specific scanners are just the ones known by the software producers (so, more updates are needed than in other types of scanners). Moreover, this type of anti-virus is weak against morphing viruses (cf.
section above). If a macro virus change its content (so, its signature), it cannot be detected any more by the
virus-specific scanners, even if it is the same virus doing the same actions. Its signature does not match the one declared in the virus scanner.
Additional to the responsibility of the anti-virus is the user's responsibility: if a potential macro virus is detected, the user can choose what to do with it: ignore it,
quarantine
A quarantine is a restriction on the movement of people, animals, and goods which is intended to prevent the spread of disease or pests. It is often used in connection to disease and illness, preventing the movement of those who may have bee ...
it or destroy it, but the last option is the most dangerous.
The anti-virus can activate some destructive macro viruses which destroy some data when they are deleted by the anti-virus.
So, both virus scanners and users are responsible for the security and the integrity of the documents/computer.
Moreover, even if the anti-virus is not optimal in the virus detection, most macro viruses are detected and the progression in virus detection improves but with creation of new macro viruses.
Version history
* VBA was first launched with MS Excel 5.0 in 1993. It became an instant success among developers to create corporate solutions using Excel. Inclusion of VBA with Microsoft Project, Access and Word replacing Access BASIC and
WordBASIC
WordBASIC was a subset of Microsoft QuickBASIC customized for word-processing in Microsoft Word. It was replaced by Visual Basic for Applications (VBA) when Word 97 was released. Contrarily to VBA, WordBasic was not object-oriented
Object-o ...
respectively made it more popular.
* VBA 4.0 is the next famous release with a totally upgraded version compared to previous one. Released in 1996, it is written in C++ and became an object oriented language.
* VBA 5.0 was launched in 1997 along with all of MS Office 97 products. The only exception for this was Outlook 97 which used
VBScript
VBScript (Microsoft Visual Basic Scripting Edition) is a deprecated programming language for scripting on Microsoft Windows using Component Object Model (COM), based on classic Visual Basic and Active Scripting. It was popular with system admi ...
.
* VBA 6.0 and VBA 6.1 were launched in 1999, notably with support for COM add-ins in Office 2000. VBA 6.2 was released alongside Office 2000 SR-1.
* VBA 6.3 was released after Office XP, VBA 6.4 followed Office 2003 and VBA 6.5 was released with Office 2007.
* Office 2010 includes VBA 7.0. There are no new features in VBA 7 for developers compared to VBA 6.5 except for 64-bit support. However, after VBA 6.5/Office 2007, Microsoft stopped licensing VBA for other applications.
* Office 2013, Office 2016, Office 2019 and Office 2021 include VBA 7.1.
Development
As of July 1, 2007, Microsoft no longer offers VBA distribution licenses to new customers. Microsoft intended to add .NET-based languages to the current version of VBA ever since the release of the
.NET Framework, of which versions 1.0 and 1.1 included a scripting runtime technology named ''Script for the .NET Framework''. Visual Studio .NET 2002 and 2003 SDK contained a separate scripting IDE called ''Visual Studio for Applications'' (VSA) that supported VB.NET.
One of its significant features was that the interfaces to the technology were available via
Active Scripting
Active Scripting (formerly known as ActiveX Scripting) is the technology used in Windows to implement component-based scripting support. It is based on OLE Automation (part of COM) and allows installation of additional scripting engines in the for ...
(
VBScript
VBScript (Microsoft Visual Basic Scripting Edition) is a deprecated programming language for scripting on Microsoft Windows using Component Object Model (COM), based on classic Visual Basic and Active Scripting. It was popular with system admi ...
and
JScript
JScript is Microsoft's legacy dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer web browser and HTML Applications, and as a standalone Windows scripting language.
JScript is implemented as an Active Scripting eng ...
), allowing even .NET-unaware applications to be scripted via .NET languages. However, VSA was deprecated in version 2.0 of the .NET Framework,
leaving no clear upgrade path for applications desiring Active Scripting support (although "scripts" can be created in
C#,
VBScript
VBScript (Microsoft Visual Basic Scripting Edition) is a deprecated programming language for scripting on Microsoft Windows using Component Object Model (COM), based on classic Visual Basic and Active Scripting. It was popular with system admi ...
, and other .NET languages, which can be
compiled and executed at run-time via
libraries
A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
installed as part of the standard .NET runtime).
Microsoft dropped VBA support for
Microsoft Office 2008 for Mac. VBA was restored in
Microsoft Office for Mac 2011. Microsoft said that it has no plan to remove VBA from the Windows version of Office.
With
Office 2010, Microsoft introduced VBA7, which contains a true pointer data type: LongPtr. This allows referencing 64-bit address space. 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. This did not affect the 32-bit version Office 2010. Microsoft eventually released a 64-bit version of MSComCtl with the July 27th, 2017 update to Office 2016.
See also
*
Visual Studio Tools for Applications
*
Visual Studio Tools for Office
*
Microsoft Visual Studio
Visual Studio is an integrated development environment (IDE) developed by Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms ...
*
Microsoft FrontPage
*
OpenOffice Basic
OpenOffice Basic (formerly known as StarOffice Basic or StarBasic or OOoBasic) is a dialect of the programming language BASIC that originated with the StarOffice office suite and spread through OpenOffice.org and derivatives such as Apache OpenOff ...
*
LotusScript
*
Microsoft Power Fx
References
{{Authority control
Articles with example BASIC code
BASIC programming language family
Macro programming languages
Microsoft Office
Microsoft programming languages
Programming languages created in 1993