2012-05-27

LibreOffice Basic - 1st Step

Since I am a big fan of VBA, I decided to try a simple code in LibreOffice Basic / StarBasic...
For me it is most important that you can access different cells on the sheet so you can run all your logic on them.
First I filled 4 cells this way:

I want to display the contents of 1 cell of the current sheet with message box. In this table you can compare the few lines of code in both languages.

-VBALibreOffice Basic
1Sub test()Sub test
2Dim oSheet As WorksheetDim oSheet
3Set oSheet = ActiveSheetoSheet = ThisComponent.CurrentController.ActiveSheet
4MsgBox (oSheet.Cells(1, 1))msgbox(oSheet.getCellByPosition(1,1).String)
5End SubEnd Sub

Comments:

1st line: the same. LibreOffice can run without ()
2nd line: in VBA you specify the type of object. in LOB there is only one type - object. And if you omit the type (i.e. Dim oSheet As Integer) it is object by default (like Variant in VBA).
3rd line: in LOB the object model is different! You don't need SET statement any more, because there is only one object type in LOB! Downwards you will find a link with more info
4th line: msgbox command is similar. Note that Cells(1, 1) returns cell A1, BUT getCellByPosition(1,1).String returns cell B2, it is 0 based !!!
5th line: the same


And here is the result in LOB....


You can find an excellent document comparing VBA and LibreOffice Basic (StarBasic) here:
http://www.openoffice.org/documentation/HOW_TO/various_topics/VbaStarBasicXref.pdf

2012-05-19

SAPCAR GUI

I released the first version of SC GUI and currently I am working on version 1.1.
The main thing it does - extracts SAR and CAR archives, but you need to supply your own downloaded SAPCAR.exe file! and put it in the same folder.
You can read and follow all details here:
http://scn.sap.com/blogs/firesword/2012/04/18/sapcar-gui


I will post new versions also here, because I am not sure that I can keep my blog in SCN forever.


Disclaimer: This is NOT official SAP software and it is NOT bug free.
This is freeware. Use it on your own risk.

Prerequisites:
- NO installation needed
- You have to download your own SAPCAR.exe and put it in the same folder as scgui.exe

Functions:
- Displays the archive contents
- Extracts chosen or all files in the archive file folder (you cannot choose a folder for now)
- Can register .CAR and .SAR extension to open with double click
- Can open a single CAR/SAR file
- It is easy to upgrade - just put the new SAPCAR.exe in the folder


Known problems:
- if you move the scgui.exe file in other folder you have to register the SAR/CAR extensions again
- if SAR/CAR extensions are registered to other windows program, it is possble that
   the "Register.." button will not work. You have to unregister them first (right click / Properties)
- You need administrator rights for "Register.." button (or "Run As administrator" in Windows 7).
- does not display hierarchical structure, just a list of all files and folders

Test:
- tested on WinXP 32bit
- tested on Win7 64bit (with both 32 and 64 bit SAPCAR.exe)
- should work on every Win OS as long as your SAPCAR.exe 32/64 works