Compatibility with Visual Basic


With respect to syntax and BASIC functionality, OOo Basic (also known as Star Basic) is very similar to Visual Basic. The two Basic dialects are nothing alike when it comes to manipulating documents, but the general command set is is very similar. There are differences, however, and they are noted throughout the text where appropriate.

Steps are being taken to improve the general compatibility between the two dialects. Some of the planned, and sometimes already working, enhancements are scheduled for release with OOo 2.0. Just remember that nothing is certain until it happens. I consider information on future enhancements as speculation until it is out, even if it seems very probable.

Many of the planned changes are not backward compatible with existing behavior. To help resolve these conflicts, a new compiler option and a new run-time mode will be introduced to specify the behavior.

The compiler option "Option Compatible" will direct some features. This option will affect only the module in which it is contained. Because a macro calls different modules during its execution, both the old and new behavior may be used, depending upon the existence of "Option Compatible" in each called module. Setting the option in one module and then calling another module will have no effect in the called module.

In OOo 1.1.0, "a" is not a valid variable name . If, however, a module contains "Option Compatible," all characters defined as letters in the Latin-1 (ISO 8859-1) character set are accepted as part of an identifier name. This is just one of many changes that use "Option Compatible."

A run-time function, CompatibilityMode( True/False), allows the behavior of run-time functions to be modified during the execution of a macro. This provides the flexibility to enable the new run-time behavior, perform some operations, and then disable the new run-time behavior. Hopefully, some method of probing the current mode will be provided.

Both Visual Basic and OOo Basic support the rmdir() command to remove a directory. VBA can remove only empty directories, but OOo Basic can recursively remove an entire directory tree. If CompatibilityMode(True) is called prior to calling rmdir(), OOo Basic will act like VBA and generate an error if the specified directory is not empty. This is just one of many changes that use CompatibilityMode().




OpenOffice.org Macros Explained
OpenOffice.org Macros Explained
ISBN: 1930919514
EAN: 2147483647
Year: 2004
Pages: 203

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net