WordPerfect VBA 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 is Corel licensing 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 alreay 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.

If you are looking for VBA support you need to carefully check that the package you are buying contains VBA. For example, WordPerfect X3 is available in Standard, Professional, Student, and Home Office editions. Only the Professional Edition offers VBA capability.

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.

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.
  • 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

Most Professional Edition (or equivalent) versions of WordPerfect come with a Programming Guide for VBA.

For additional information, 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. Many 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.