Apache OpenOffice (AOO) Bugzilla – Issue 69252
Inconsistent handling of Basic With Statements
Last modified: 2017-05-20 11:27:35 UTC
Another incompatibity between VBA and OOoBasic FYI: i=1 With ThisComponent.Sheets(i) ' or ActiveWorkbook.Sheet(i) in VBA MsgBox .Name i = 2 MsgBox .Name End With prints "Sheet2" and "Sheet3" in Calc/OOoB but "Sheet1" and "Sheet1" in Excel/VBA. (Ignoring the difference in offset which is a feature of the base count for Sheet collections varying), the main point to note that OOo treats With <x> as a symbolic macro substituting <x> before the appropriate bare dots. VBA treats With <x> as Dim tmp000x=<x> then substitutes tmp00x before the appropriate bare dots. In otherwords, VBA evaluates With by value and OOoB evaluates it by reference. This difference can cause nasty migration surprises, and the value form also generates a lot more efficient runtime Pcode. The basic compiler should be changed to be consistent with VBA at least for the Option Compatible mode.
STARTED, OOo 2.x
set target from 2.x to 3.x according to http://wiki.services.openoffice.org/wiki/Target_3x
Reset assigne to the default "issues@openoffice.apache.org".