|
Visual Basic for Applications (VBA) is an implementation of Microsoft's Visual Basic, an event driven programming language and associated integrated development environment (IDE) which is built into most Microsoft Office applications. It is also built in to Office applications for Apple Mac OS, other Microsoft applications such as Microsoft MapPoint and Microsoft Visio — a former independent application which was acquired by Microsoft — as well as being at least partially implemented in some other applications such as AutoCAD, WordPerfect and ESRI ArcGIS. It supersedes and expands on the capabilities of earlier application-specific macro programming languages such as Word's WordBasic, and can be used to control almost all aspects of the host application, including manipulating user interface features, such as menus and toolbars, and working with custom user forms or dialog boxes. VBA can also be used to create import and export filters for various file formats, such as ODF. Image File history File links VBA_logo. ...
Microsoft Corporation, (NASDAQ: MSFT, HKSE: 4338) is a multinational computer technology corporation with global annual revenue of US$44. ...
This article is about the Visual Basic language shipping with Microsoft Visual Studio 6. ...
Please wikify (format) this article or section as suggested in the Guide to layout and the Manual of Style. ...
An integrated development environment (IDE), also known as integrated design environment and integrated debugging environment, is a programming environment that has been packaged as an application program,that assists computer programmers in developing software. ...
Microsoft Office is an office suite from Microsoft for Microsoft Windows and Apple Mac OS X operating systems. ...
Apple Inc. ...
This article relates to both the original Classic Mac OS as well as Mac OS X, Apples more recent operating system. ...
Three maps generated by MapPoint North America 2001 (outside the detailed dataset), Encarta 2005 (not very detailed) and Microsoft AutoRoute 2004 (highly detailed). ...
This article is about a software application. ...
AutoCAD is a CAD software application for 2D and 3D design and drafting, developed and sold by Autodesk, Inc. ...
WordPerfect is a proprietary word processing application. ...
For the Irish research group, see Economic and Social Research Institute. ...
ArcGIS is the name of a group of Geographic Information System software product lines produced by ESRI. At the desktop GIS level, ArcGIS can include: ArcReader, which allows one to view and query maps created with the other Arc products; ArcView, which allows one to view spatial data, create maps...
For other uses, see Macro (disambiguation) A macro in computer science is a rule or pattern that specifies how a certain input sequence (often a sequence of characters) should be mapped to an output sequence (also often a sequence of characters) according to a defined procedure. ...
Microsoft Word is Microsofts flagship word processing software. ...
Semi-official ODF logo The OpenDocument format (ODF, ISO/IEC 26300, full name: OASIS Open Document Format for Office Applications) is a file format for electronic office documents, such as spreadsheets, charts, presentations, databases and word processing documents (e. ...
VBA itself is an interpreted language. As its name suggests, VBA is closely related to Visual Basic, but can normally only run code from within a host application rather than as a standalone application. It can, however, be used to control one application from another using OLE Automation. For example, it is used to automatically create a Word report from Excel data. In computer science, an interpreter is a computer program that executes, or performs, instructions written in a computer programming language. ...
This article is about the Visual Basic language shipping with Microsoft Visual Studio 6. ...
Stand-alone is a confusing and misleading term, used to refer to various categories of computer programs, but rarely in a consistent fashion. ...
OLE Automation is a late-binding extension to COM and IUnknown. ...
Microsoft Word is Microsofts flagship word processing software. ...
Microsoft Excel (full name Microsoft Office Excel) is a spreadsheet application written and distributed by Microsoft for Microsoft Windows and Mac OS. It features calculation and graphing tools which, along with aggressive marketing, have made Excel one of the most popular microcomputer applications to date. ...
VBA is functionally rich and extremely flexible but it does have some important limitations, including limited support for function pointers which are used as callback functions in the Windows API. It has the ability to use (but not create) (ActiveX/COM) DLLs, and later versions add support for class modules. A function pointer is a type of pointer in C, C++, D, and other C-like programming languages. ...
A callback is often back on the level of the original caller. ...
Windows API is a set of APIs, (application programming interfaces) available in the Microsoft Windows operating systems. ...
Component Object Model (COM) is a platform for software componentry introduced by Microsoft in 1993. ...
Dynamic-link library (also written without the hyphen), or DLL, is Microsofts implementation of the shared library concept in the Microsoft Windows and OS/2 operating systems. ...
Image File history File links Download high resolution version (1024x702, 40 KB) Summary VBA In Office 2003 Licensing This is a screenshot of copyrighted computer software for Microsoft Windows, and copyright for it is most likely held by the author(s) or the company that created the software. ...
Image File history File links Download high resolution version (1024x702, 40 KB) Summary VBA In Office 2003 Licensing This is a screenshot of copyrighted computer software for Microsoft Windows, and copyright for it is most likely held by the author(s) or the company that created the software. ...
Language
VBA is an interpreted language, meaning its instructions are run, or interpreted, when the source code is run. Despite its resemblance to many old BASIC dialects, VBA is not compatible with any of them except Microsoft Visual Basic, where source-code of VBA Modules can be directly imported. Compatibility ends with Visual Basic Version 6; VBA is not compatible with VB.NET. VBA is proprietary to Microsoft and is not an Open standard. This article is about the programming language. ...
Visual Basic . ...
This article or section cites very few or no references or sources. ...
For a more complete description of the strengths and weaknesses of the Visual Basic language, see Visual Basic. This article is about the Visual Basic language shipping with Microsoft Visual Studio 6. ...
Automation Interaction with the host application uses OLE Automation. Typically, the host application provides a type library and 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. In programming languages a data type defines a set of values and the allowable operations on those values[1]. For example, in the Java programming language, the int type represents the set of 32-bit integers ranging in value from -2,147,483,648 to 2,147,483,647, and...
API and Api redirect here. ...
VBA programs which are written to use the OLE Automation interface of one application can't 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. For a more complete description of how VBA programs interact with their host application see , see OLE Automation. On the reverse of this, you can automate multiple applications 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 your application. 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. OLE Automation is a late-binding extension to COM and IUnknown. ...
For example: In Microsoft Access, you automatically have access to the Access library. You may also create references to the Excel, Word, and Outlook libraries. This will allow you to create an application that runs a query in Access, exports the results to Excel, formats the text, then writes a Mail Merge document in Word that it automatically e-mails to each member of your original query through Outlook. It is important to note that Outlook does contain a security feature that forces a user to allow, disallow, or cancel an e-mail being sent through an automated process with a forced 5 second wait. Information on this can be found at the Microsoft website. VBA programs, or macros, can be attached to a menu button, a keyboard shortcut, or an event in the application, such as the opening of the document. The language also provides a user interface in the form of UserForms, which can host ActiveX controls for added functionality. For other uses, see Macro (disambiguation) A macro in computer science is a rule or pattern that specifies how a certain input sequence (often a sequence of characters) should be mapped to an output sequence (also often a sequence of characters) according to a defined procedure. ...
A keyboard shortcut (also known as an accelerator key, shortcut key, or hotkey) is one or a set of keyboard keys that, when pressed simultaneously, perform a predefined task. ...
ActiveX control is a term used to denote reusable software components that are based on Microsoft Component Object Model (COM). ...
Security concerns Like any common programming language, VBA macros can be created with a malicious intent. Using VBA, most of the security 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, much like those for internet browsers. End-users can protect themselves from attack by disabling macros from running in an application if they do not intend to use documents containing them, or only grant permission for a document to run VBA code if they are sure the source of the document can be trusted. This article describes how security can be achieved through design and engineering. ...
A web browser is a software package that enables a user to display and interact with documents hosted by web servers. ...
The end user is a central concept in software engineering, referring to an abstraction of the group of persons who will ultimately use a piece of software (i. ...
Examples A common use of VBA is to add functionality that may be missing from the standard user interface. This macro provides a shortcut for entering the current date in Word: The user interface is the part of a system exposed to users. ...
Microsoft Word is Microsofts flagship word processing software. ...
Sub EnterCurrentDate() ' EnterCurrentDate Macro ' Macro recorded 15/03/2005 by UserName ' Selection.InsertDateTime DateTimeFormat:="dd-MM-yy", InsertAsField:=False, _ DateLanguage:=wdEnglishAUS, CalendarType:=wdCalendarWestern, _ InsertAsFullWidth:=False End Sub VBA is useful for automating database tasks such as traversing a table: Sub LoopTableExample Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb Set rs = db.OpenRecordset("SELECT * FROM tblMain") Do Until rs.EOF MsgBox rs!FieldName rs.MoveNext Loop rs.Close Set db = Nothing End Sub VBA can be used to create a user defined function (UDF) for use in a Microsoft Excel workbook: Microsoft Excel (full name Microsoft Office Excel) is a spreadsheet application written and distributed by Microsoft for Microsoft Windows and Mac OS. It features calculation and graphing tools which, along with aggressive marketing, have made Excel one of the most popular microcomputer applications to date. ...
Public Function BusinessDayPrior(dt As Date) As Date Select Case Weekday(dt, vbMonday) Case 1 BusinessDayPrior = dt - 3 'Monday becomes Friday Case 7 BusinessDayPrior = dt - 2 'Sunday becomes Friday Case Else BusinessDayPrior = dt - 1 'All other days become previous day End Select End Function Example of how to add an external application object (You must have the application library referenced in your application before this): Public Sub Example() Dim XLApp As Excel.Application Dim WDApp As Word.Application Set XLApp = CreateObject("Excel.Application") set WDApp = createObject("Word.Application") ' ...your code here... XLApp.Quit WDApp.Quit Set XLApp = Nothing Set WDApp = Nothing End Sub Future Microsoft plans to eventually replace VBA with Visual Studio Tools for Applications (VSTA), an application customization toolkit based on the .NET Framework. From Dr Ex's article: The Microsoft . ...
VSTA now replaces VSA [Visual Studio for Applications] as the technology ISVs will use to provide customization capabilities in their applications. […] VSA was a thin-client, server-driven alternative to VBA built on Visual Studio. The server approach was viewed by ISVs as less useful than a rich-client model, so based on their feedback, Microsoft began development of VSTA. There are ISVs successfully using VSA today, but we found that its applicability was limited. Some of the technology developed for VSA is incorporated within VSTA. VSTA application customization takes better advantage of rich client functionality than VSA, offering a highly optimized environment for application customization on both the client and the server. An Independent Software Vendor (ISV) is a business term for companies specializing in making or selling software, usually for niche markets. ...
A HP T5700 thin client, with flash memory A Neoware m100 thin client. ...
Office 2007 continues to use the legacy VBA engine; however, Visual Studio Tool for Office (VSTO) is available. Support for VBA in Microsoft Office for Mac will be dropped with the release of version 12, in 2008[1]. See also VB.NET. The first version of VSTA was released in April of 2006 and has been integrated into several ISV's, including InfoPath 2007 and ABB Robotics. The next version of VSTA (based on Visual Studio 2008 otherwise known as "Orcas") will be released in February 2008. The second version of VSTA is dramatically different than the first version, including features such as dynamic programing and support for WPF, WCF, WF, LINQ, and .NET 3.5. 2007 Microsoft Office system, also known as Microsoft Office 2007, is Microsofts next release of its productivity suite, slated to replace Microsoft Office 2003. ...
This subsystem is a part of . ...
This subsystem is a part of . ...
This subsystem is a part of . ...
Language intergrated query (LINQ) is a Microsoft project that aims to add a native querying syntax to C# and VB.Net. ...
The Microsoft . ...
References Year 2006 (MMVI) was a common year starting on Sunday of the Gregorian calendar. ...
is the 219th day of the year (220th in leap years) in the Gregorian calendar. ...
Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ...
is the 145th day of the year (146th in leap years) in the Gregorian calendar. ...
External links - VBA Home on Microsoft
- TechBookReport Tutorial on VBA in Excel
|