Convert OpenOffice macro to Excel

Creating a macro - Writing a Script - Using the API

Convert OpenOffice macro to Excel

Postby gutee » Fri Jan 25, 2019 12:06 pm

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
gutee
 
Posts: 19
Joined: Wed Jan 09, 2019 9:12 am

Re: Covert OpenOffice macro to Excel

Postby FJCC » Fri Jan 25, 2019 2:09 pm

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?
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 7056
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Convert OpenOffice macro to Excel

Postby gutee » Sat Jan 26, 2019 4:46 am

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
gutee
 
Posts: 19
Joined: Wed Jan 09, 2019 9:12 am

Re: Convert OpenOffice macro to Excel

Postby RoryOF » Sat Jan 26, 2019 10:37 am

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.6 on Xubuntu 18.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 28400
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Convert OpenOffice macro to Excel

Postby Lupp » Sat Jan 26, 2019 1:36 pm

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 6.1 and older versions, PortableOpenOffice 4.1.5 and older, StarOffice 5.2
---
Let's create a powerful UFO: United Free Office!
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2339
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Convert OpenOffice macro to Excel

Postby Villeroy » Sat Jan 26, 2019 1:55 pm

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, OpenOffice 4.x & LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26390
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Convert OpenOffice macro to Excel

Postby Zizi64 » Sat Jan 26, 2019 4:03 pm

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; LO4.4.7, LO6.1.5 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.1 and AOO4.1.5
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.
User avatar
Zizi64
Volunteer
 
Posts: 7767
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests