Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Visual Basic for Applications
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Automation== Interaction with the host application uses [[OLE Automation]]. Typically, the host application provides a [[data type|type]] library and [[application programming interface]] (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 (computer science)|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 [[Real-time data|RealTimeData]] (RTD) which allows calling a [[Component Object Model]] (COM) automation server for dynamic or realtime financial or scientific data.<ref>{{cite web|url=https://support.microsoft.com/en-us/help/289150/how-to-set-up-and-use-the-rtd-function-in-excel|title=How to set up and use the RTD function in Excel|website=msdn.microsoft.com}}</ref>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Visual Basic for Applications
(section)
Add topic