Apache OpenOffice (AOO) Bugzilla – Issue 9224
Translation from VBA to StarBasic help
Last modified: 2012-06-15 14:53:00 UTC
Something that has arisen on the [users] list. It would be a very useful item if there was some sort of listing/cross reference between VBA and the equivalent StarBasic commands/syntax. Even a simple listing of functions with the equivalent, and notes on any factors needing attention. This would also assist those who might try to develov a "batch translation" routine. Those users concerned seem to feel that a perfect translation is not essential, provided the routine did a reasonable job.
Changing to a Task so it shows up under the Doc Task list. Thanks.
If there was a "Hook" in OOo which would be called to convert VBA to StarBasic, it would allow at least some tools to be written for limited uses, and may eventually build up a comprehensive convertion tool. This "Hook" would be for example an "event" similar to the OpenDocument event but would be something like "TranslateVBA" event. This would then allow users to add StarBasic macros to do some string convertions on the VBA to create StarBasic instead.
Can we get an example of some commands in VBA that need to be translated?
Hi All, Please look at http://qa.openoffice.org/issues/show_bug.cgi?id=27344 I hope somebody can help Michael Meek from Ximian. which I believe is related to this subject. Thanks.
Created attachment 15078 [details] Preliminary draft for early feedback V0.01
This is a big issue for me, as I have a number of large VBA macros which I really need to ue. This is the only reason I have to keep the M$ program available on the PC. Even a partial equivalent-command/syntax list would be an enormous initial help.
Created attachment 15110 [details] Utility to lists information on Spreadsheet objects
Created attachment 15215 [details] V0.2 - Added more example coding fragments
Added Michael Meeks of Ximian (in CC) which work for issue 27344 Utomo > Michael Meeks : Please see some files in this issue. I hope it helps. Thanks
Added drbyte to CC
Created attachment 15408 [details] V0.3 - Additional example code fragments & misc. editorial changes
adding myself to CC
adding me to cc
Created attachment 15573 [details] Additional examples, documnet porting example, final preliminary draft
Created attachment 15574 [details] Companion example Excel Workbook and Calc Spreadsheet to manual
I think this document is excellent but I would lke to make some suggestions. My suggestions are ordered from most to least important (in my opinion): On pg 24 the information about radio buttons is not correct. In OOo radio buttons are grouped by being adjacent in order not by having a group control, the group control has no effect at all. The notes about inheritance in OOo at the start are not strictly speaking correct. The IDL is a specification and in my experience of the few time that I have looked at the source code inheritance is not happening but functionality is directly coded for the object. See:http://www.oooforum.org/forum/viewtopic.php?t=9120 for some discussion about this. Mostly this doesn't matter except for when there are optional components in which case there is no way of knowing from the IDL whether the object you are working with has that optional component or not. The quotes in the source code examples are "smart quotes" rather than ordinary quotes and thus when copying and pasting them into the IDE they need to be changed. I think it would be better if they were ordinary quotes. In the section on dialog boxes you talk about the global variable "dlg". In OOo a global variable is one that is available across libraries and as such having a global valiable called "dlg" might not be a good idea (conflicts between different libraries) and so a library level variable (declared at the module level) might be more appropriate. It might be good to mention for listboxes the method "addItems". Adding 900 items to a list box using addItem on my computer takes 20 seconds, using addItems is virtually instantaneous. In Excel there is the RefEdit control and there is no mention of how to implement one in Calc. For a working example see MyDataPilot.sxc, module sheet ModDPtextControls available from http://homepages.paradise.net.nz/hillview/OOo/ While it is correct that there is no tab control in OOo there are work arounds for implementing them using oDlg.model.step. Some such mention would be good. The document has a routine for returning the address of a range but it doesn't mention the rangeAddress or cellAddress structs. Given that these structs are regularly used perhaps a routine that uses them, while less elegant, might be more helpful. I have such routines in my MyDataPilot.sxc on module sheet _Utilities. No where have I read something that explains directly how to use the API for OOo BASIC. The closest is Sun'sStarOffice 7 Office Suite - Basic Programmers Guide, but I still feel that this, and the Developer's Guide, somehow make assumptions that aren't obvious to everyone. I was going to write this for my migrationfrom MO to OOo document but haven't done so yet (I lost heart in that project, a bit, due to almost no feedback and on discovering a similar document put out by Sun). Something like (crudely written off the top of my head): The top of each page in the API reference has the following links: Overview: link to the page: com.sun.star the top level of the API Module: link to the second layer down for the current object Use: link to a page where sometimes it will describe some of the places that the current object is used. Devguide: link to a position in a page that talks about how to use this object usually with Java examples. Index: link to a page with all objects starting with the letter A and has links to the other letters in the alphabet The second line contains links to tables on the current page The third line contains the heirarchy for the object and this is used in the following ways: To create a new object depends on the type of object: Structs: oStruct = createUnoStruct("com.sun.star.style.TabStop") or dim oStruct as new com.sun.star.style.TabStop note the capitalisation everything up to the last item is always lowercase and the last item is in TitleCase. and so on Once again, the document VBAStarBasicXref is excellent and I learnt things from it - thankyou. I would appreciate similar comments to the above about some of my work and so hope that these comments are helpful. Cheers, Ian Laurenson
Created attachment 15705 [details] Version 1.0: General availability of document; added material on multi-page control & pointers to reference material.
Created attachment 15706 [details] Companion file for the manual; added example for multi-page control
This is a very valuable task! This document focusses on Calc macros, perhaps the title of this task should state this (and a new task could be started for Writer).
At the risk of being getting swamped, I willing to expand the document to include Writer/StarBasic. I just don't have any experience with Word/VBA. If I get a few examples of Word/VBA documents, I'd take a stab at adding a mapping of Word/VBA to Writer/StarBasic.
Attaching a .dot and .doc that should help
Created attachment 15825 [details] Calendar word file
Created attachment 15826 [details] Calendar word template
On the webpage as of 2004-06-14-08h11. Closing as completed.
The Issue you raised has been marked as 'Resolved' and not updated within the last 1 year+. I am therefore setting this issue to 'Verified' as the first step towards Closing it. If you feel this is incorrect, please re-open the issue and add any comments. Many thanks, Andrew Cleaning-up and Closing old Issues ~ The Grand Bug Squash, pre v3 ~ http://marketing.openoffice.org/3.0/announcementbeta.html
As per previous posting: Verified -> Closed. A Closed Issue is a Happy Issue (TM). Regards, Andrew