Frequently Asked Questions About WordPerfect VBA
Frequently asked questions about VBA in WordPerfect
Important note!
As of WordPerfect Office 12, Visual Basic for Applications (VBA) is no longer included in the software package. VBA will still work in version 12 and above, but only if you have installed another program (such as Microsoft Office 2007) that includes the VBA files.
Because of this change, we no longer recommend VBA for any new automation development in WordPerfect. We recommend instead that you look into developing automation solutions using Visual Basic .NET, as outlined later in this FAQ.
What is this FAQ about?
This FAQ is about Microsoft VBA used in Corel WordPerfect versions 9 and later.
What is VBA?
VBA stands for Visual Basic for Applications. VBA is a widely accepted "subset" of the Visual Basic application programming platform. Unlike Microsoft Visual Basic, which is designed to build stand-alone applications, VBA is designed to automate other applications, such as word processors, electronic spreadsheets, and database managers.
Who developed VBA?
Microsoft is the creator of both Visual Basic and VBA. Microsoft licenses VBA to other software companies, who in turn integrate the VBA system into their programs. VBA is mostly known as the macro language for Microsoft Office. In Microsoft Office VBA is used to build macros for Microsoft Word, Excel, and other applications.
Why did Corel license VBA from Microsoft?
The PerfectScript programming facility now used in WordPerfect and several other Corel products is a highly capable macro language, with a number of features that distinguish itself from other macro languages, including VBA. Still, VBA offers an widely used "standard" in the computing industry. Since most Corel programs already have their own macro language, VBA simply offers additional choice.
What versions of WordPerfect support VBA?
WordPerfect for Windows version 9 and later support VBA.
However, not all packages ("editions") of each version support VBA. Because VBA is a licensed component, it adds cost to the package, and so VBA is not included with the lower-priced editions.
In addition, while WordPerfect 12 and above support VBA, these versions do not come with the actual VBA program files. If you'd like to use VBA with WordPerfect 12 or higher, the VBA files must be installed by some other program. This may include a previous version of WordPerfect that came with VBA, or a copy of Microsoft Office. Note it must be VBA version 6.3 or later. Earlier versions of VBA won't work, and these earlier version also pose a general security risk.
If you are looking for VBA support you need to carefully check that the package you are buying contains VBA. In general only the Standard Professional Edition offers VBA capability, but check the specifications before you purchase.
What happens to our old WordPerfect macros?
VBA is provided as an additional and alternative macro language to WordPerfect. The long-standing macro language in WordPerfect for Windows, PerfectScript, continues to be supported, and continues to be the main macro language for the WordPerfect family.
Besides VBA and Perfectscript are there any other options for automation WordPerfect?
Yes, you also have the option of creating automation solutions using the Microsoft .NET platform, which supports several different languages. The most widely used language, especially for those who aren't in the business of writing programs full-time, is Visual Basic.
VB.NET is available as part of the Microsoft Visual Studio package, which is intended for programming professionals. You can also get it for free (that's right, FREE!) in their special Visual Basic .NET Express package. (Though free, you need to register the program to continue using it. Registration requires a valid e-mail address.)
If given a choice, we now recommend developing in VB.NET rather than VBA if you need to take advantage of Windows features not available in PerfectScript.
What are the advantages of VBA?
First, there is strength in numbers, and by far VBA is the most commonly used macro language for applications. A benefit of learning VBA is that once you master the language, you can more readily write macros for other applications.
Another major advantage of VBA is that the platform makes it easier to connect to other applications via COM (Component Object Model), such as databases and third-party applications.
What are the disadvantages of VBA?
While VBA has many strengths, it also has some disadvantages. Here are some you'll want to consider:
- VBA as a technology is over 10 years old, and it is being slowly replaced by a new programming platform, .NET Framework. There is no indication that Corel will license the .NET Framework platform for use in its office products.
- Not all editions of WordPerfect support VBA, while all editions support PerfectScript. This may restrict your ability to deploy VBA-based solutions to customers, or throughout an organization.
- Starting with WordPerfect 12, Corel is no longer including VBA files as part of the package, indicating it is phasing out support for it.
- VBA requires a deeper understanding of how the application works, and requires more study and development effort. PerfectScript is easier to learn.
Will a VBA macro in Microsoft Word run under WordPerfect?
No. Although both may use the VBA language, the two programs use different object models. The difference in object models will preclude a macro written for one program from running on another.
What is an object model?
VBA interacts with its host application (e.g. Microsoft Word or WordPerfect) by accessing the application's objects. These objects are identities given to different parts of the program, and to the documents the program creates. The object model is simply the way VBA communicates with its host application.
Every application has a different object model, and each object model is designed to best suit the way the application functions. For example, the object model for Microsoft Excel is different than the object model for Microsoft Word.
Does WordPerfect comes with any VBA learning tools
The Standard and Professional editions of WordPerfect now come with a Programming Guide for VBA. It's of minor use as a programming guide.
There are some third-party VBA books which may help you better understand the programming basics. Most of these are for Microsoft products, but they have some use for WordPerfect as well. See Field Guide to Books on Writing Microsoft Word Macros for additional information.
Is VBA hard to learn?
VBA is an object-based programming language, meaning that it interacts with its host application through the use of objects. Learning how to manipulate these objects can be difficult, especially if you do not have prior experience with an object-based or object-oriented programming language. Most users consider VBA harder to learn than WordPerfect's PerfectScript language.
Should I continue to develop macros in PerfectScript?
There is no reason to curtail your current PerfectScript tasks.
In fact, we highly recommend that unless there is a specific reason otherwise, macro development using PerfectScript is preferred. The PerfectScript language will continue to be viable in versions of WordPerfect to come, and will continue to do the jobs you give it. In fact, for many jobs, PerfectScript remains the preferred tool.
Should PerfectScript not provide the functionality you require, we recommend a solution built using the (did we say free?) Visual Basic .NET tools.