Visual Basic for Applications and WordPerfect Office Suite 2002
Visual Basic for Applications (VBA) is an object-oriented programming language that lets you create VBA macros to automate tasks. You can, for example, create a macro in WordPerfect that changes the color of the headings. WordPerfect Office 2002 includes version six of the Microsoft Visual Basic for Applications (VBA) programming language.
VBA is an event-driven programming language. Most of the code you create is written to respond to an event. An event is an action that is recognized by VBA; for example, clicking a button or choosing an option from a list box. Unlike traditional procedural programming, in which the program starts at line 1 and executes line by line, event-driven programming executes code in response to events.
All events in the application are code placeholders. It is up to you to code the response. All events are called in response to a specific action. When an action occurs, the appropriate event will be called and the code located within the event is executed. You can create simple or complex events. You can code a single line that displays a message box or write an entire procedure that interacts with a database.
Getting Started with VBA
What is Visual Basic for Applications?
What is Event driven programming?
Visual Basic, Visual Basic for Applications and VBScript
VBA and PerfectScript
Working in the VBA Editor
Using VBA Macros
Accessing an Application from another Application's macro
What is Visual Basic for Applications?
Visual Basic for Applications (VBA) is a subset of the Microsoft Visual Basic (VB) object-oriented programming environment. VBA uses the Visual Basic Editor interactive development environment and the VB programming language to enhance applications by manipulating the application's objects, exposed by its object model. VBA can access other applications by referencing that application's object model components.
WordPerfect Office 2002 includes version six of the Microsoft Visual Basic for Applications (VBA) programming language. VBA is a subset of the Microsoft Visual Basic (VB) object-oriented programming environment. VBA uses the Visual Basic Editor interactive development environment and the VB programming language to enhance applications by manipulating the application's objects, exposed by its object model. VBA is a standard programming language that allows you to customize the application for your needs and integrate Corel products with other VBA-enabled applications by referencing that application's object model components.
VBA provides you with a set of tools that you can use to customize the graphical user interface of Corel applications. These tools allow you to process information and present data in an efficient and effective forum. Developers using VBA to extend Corel applications will benefit from the familiar Visual Basic language, Rapid Application Development (RAD) integrated development environment, and fast runtime performance in the resulting integrated solutions. Developers will also benefit from an extensible forms package that supports ActiveX controls for creating user interfaces, access to the full Windows API and the underlying file system, connectivity to corporate data, and integration with other COM-based software.
Even though VBA uses the Visual Basic programming language, it is considered "for applications" because it is most often integrated into another application in order to customize the functionality of that application.
Related topics
What is Event driven programming?
Visual Basic for Applications is an event-driven programming language. Most of the code you create is written to respond to an event. Each object within an object model is defined by a property, method, event, or a combination of each. An event is a noun, and acts as something that takes place in an object. You write code for an object to respond to the act. Events are triggered by an action, such as a click, key press, or system timer. Unlike traditional procedural programming, in which the program starts at line 1 and executes line by line, event-driven programming executes code in response to events.
Related topics
What is the difference between Visual Basic, Visual Basic for Applications and VBScript?
The Microsoft Visual Basic programming system is an advanced set of programming tools that provides advanced functionality and components for the Microsoft Windows operating system and other windows-based programs. For example, with Visual Basic you can create application extensions (dll's) and stand-alone executable programs (exe's). You cannot create either of these components with VBA or VBScript.
VBA is also referred to as Visual Basic, Applications Edition. VBA is a subset of the Visual Basic programming language. It uses the programming structure of Visual Basic to manipulate objects of an object model, left exposed by an application. The manipulation of these objects results in small packets of code procedures within the application. These code procedures and resulting projects are called add ins.
VBScript is also referred to as Microsoft Visual Basic, Scripting Edition. VBScript is also a subset of the Visual Basic programming language. It is a web-based HTML document scripting language.
Related topics
What is the difference between VBA and PerfectScript?
Previously, you could only use the PerfectScript language to automate specific tasks. Both product commands and programming commands are used in conjunction with the PerfectScript language. The PerfectScript language is useful for developing simple macros. VBA offers more flexibility and power. When you use VBA to create macros, you are assisted by the Visual Basic compiler. The compiler helps you by providing context-sensitive help when you are coding a VBA macro. You can combine the power of VBA with the PerfectScript product commands to create powerful macros. You have to use the Visual Basic Editor to create VBA macros; however, PerfectScript macros are developed from the WordPerfect Editor. You can access the Visual Basic Editor only when you are working in an active document.
Related topics
Working in the VBA Editor
When you work in the VBA Editor, you can create a new object, such as a dialog box, which is known as a form. You can add controls, such as a check box or a text box. You can set the object's properties in the Property dialog box. You can also set the object's properties at run time by programming a method.
Each document that you create with VBA has a corresponding Visual Basic for Applications project. In order to customize your document with VBA coding procedures, you must open the project file in the Visual Basic Editor. To display the Editor, go to Tools|Visual Basic|Visual Basic Editor on the main menu in the application.
For more detailed information on constructing code procedures and setting properties, see the Microsoft Visual Basic Help in the Visual Basic Editor.
Related topics
Using VBA macros
VBA allows you to edit and play macros that automate a series of tasks within an application.
You can store a VBA macro in the document by saving the document. Once you have saved the document, you can close and reopen the document and access the macro. After you have developed the macro, you should debug it. You can step through each macro line by line. This is a useful exercise to ensure that the macro will have the desired outcome. A project macro is not available if the document is closed. After you have debugged the macro, you can play the macro.
For more detailed instruction relating to VBA and its programming environment, please consult the "Microsoft Visual Basic for Applications Help" from the Help menu in the Visual Basic Editor.
Related topics
Accessing an Application from another Application's macro
You can access and change an application from another application's macro. VBA uses the Visual Basic Editor interactive development environment and the VB programming language to enhance applications by manipulating the application's objects, exposed by its object model. VBA allows you to customize your needs and integrate Corel products with other VBA-enabled applications by referencing that application's object model components.
For example, you could create and use a Quattro Pro object from a WordPerfect VBA macro. This allows you to change and save a Quattro Pro document from a WordPerfect VBA macro.