Convert OpenOffice macro to Excel

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
gutee
Posts: 19
Joined: Wed Jan 09, 2019 9:12 am

Convert OpenOffice macro to Excel

Post by gutee »

I have few macros run OpenOffice to draw inside the spreadsheet. How can I covert them to run inside Excel in Windows?
The code I have looks like :

Global aPoint As New com.sun.star.awt.Point
Global aSize As New com.sun.star.awt.Size
Global oPage As Object
oRectangleShape = oDocument.createInstance("com.sun.star.drawing.RectangleShape")
OpenOffice.org.3.3.0
FJCC
Moderator
Posts: 9273
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Covert OpenOffice macro to Excel

Post by FJCC »

There is no way to do that as far as I know. Excel will not run OpenOffice macros. Can you explain what you are trying to do?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
gutee
Posts: 19
Joined: Wed Jan 09, 2019 9:12 am

Re: Convert OpenOffice macro to Excel

Post by gutee »

the users for my spreadsheet will work in Windows or Linux, that means they may run the macro for draw rectangle shape in Excel(Windows) or Openoffice(Linux).
So the macro I created must able to work for both.
I think may be I need do some manually map from the OOo codes to Excel.
OpenOffice.org.3.3.0
User avatar
RoryOF
Moderator
Posts: 34611
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Convert OpenOffice macro to Excel

Post by RoryOF »

If you can write a macro that distinguishes Windows from Linux and then distinguishes Excel from OpenOffice, which will run on both operating systems, you can use two Macros - one written for Excel, one for OpenOffice and place them inside the decision loops.

This simplifies if you guarantee that Windows users will always use Excel and linux always OpenOffice = then you only need test for the operating system.

There may be other problems between the two applications, such as syntax for cell entries, but I presume you are aware of these.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Lupp
Volunteer
Posts: 3548
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Convert OpenOffice macro to Excel

Post by Lupp »

If I understood correctly, the question was mainly about drawing shapes. I would expect that drawing on Excel sheets is completely different from drawing in AOO on the model level. Who does actually know?
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Convert OpenOffice macro to Excel

Post by Villeroy »

Your macros will work on Mac, Linux and Windows if the users install LibreOffice. There is no reason to not install the required software for the task.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Convert OpenOffice macro to Excel

Post by Zizi64 »

I think may be I need do some manually map from the OOo codes to Excel.
OpenOffice.org.3.3.0
Nobody uses OO.o 3.3.0 version today - the names of the recent versions: Apache OpenOffice and its fork, the LibreOffice.
You must know it: The LibreOffice has a littlebit higher compatibility with the foreign file formats and the MS VBA macros. But there is not (never was and never will be) 100% compatibility.

There is not "linear conversion" way to full conversion of the macros. You must use different procedures and different functions with different passed paramaters in the different environments. You must totally rewrite your macros.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply