Porting Excel/VBA to Calc/StarBasic
Although OpenOffice 1.1 Calc is able to read Microsoft Excel workbooks, compatibility extends primarily to functionality found in worksheets. Excel workbooks with Visual Basic for Applications (VBA) macros embedded do not function in Calc, even though VBA and StarBasic (SB) are syntactically the same. The reason Excel/VBA workbooks do not work under Calc/SB is due to the differences in the underlying object models for Excel and Calc. The intent of this document is to show, by way of examples, how to port VBA macros accessing Excel objects to the equivalent SB macros accessing Calc objects. This manual is written from the perspective of an experienced Excel/VBA programmer. Hence the reader is assumed to know the VBA language and is familiar with the MS Excel Object Model. This document is not a tutorial on SB.
…
Although this manual answers many questions about porting Excel/VBA macros to Calc/SB, it is not complete - not all questions are answered. The reader may find it necessary to refer to the object model documentation for OpenOffice products. For the Excel/VBA programmer, it may take some some time to become comfortable with the way that OpenOffice objects are documented.
The primary difference between the Excel object model and the OpenOffice object model is that Excel’s model does not take advantage of all of the features that constitute an objectoriented programming environment. In some publications, Microsoft’s object model for their products, such as Excel, is termed “object-like”.
In a true object-oriented programming model, there is the concept of inheritance. This concept allows one object’s definition and implementation to be based on another object’s definition and implementation. Microsoft’s object-like model does not support inheritance.
To illustrate inheritance, consider the following example. There is an object called “Shape” with a method called “move()” that moves the “Shape” around on the display screen. In a true object-oriented programming environment, a new object called “Circle”, which is a type of “Shape”, can be implemented in the following manner. Instead of forcing “Circle” to implement its own “move()” method for moving around the display screen, the “Circle” object inherits the “move()” method from the “Shape” object.
…
Website: documentation.openoffice.org | Filesize: 812kb
No of Page(s): 63
Click here to download Porting Excel/VBA to Calc/StarBasic.
Related Tutorial
Tags: Calc, microsoft excel, office vba, OpenOffice, StarBasic, VBA
Comments
Leave a Reply