Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index

Re: [tdf-discuss] Macro Difficulties


Hi Charles,

Charles Jenkins schrieb:
This is a story about the usability of LO BASIC and the documentation
thereof. And also a plea for help.

I'm trying to get LibreOffice to work with SAP Business One
(hereafter called B1) in order to eliminate the need to pay for
expensive licenses for Microsoft Excel.

B1 has a toolbar button that's supposed to generate a spreadsheet for
data viewed as a table onscreen. Unfortunately, instead of really
creating a spreadsheet, B1 just dumps out a tab-separated text file
and then opens a spreadsheet called "AutoOpen.xls" that in turn loads
the text file into a new spreadsheet.

This clunky way of doing things has the advantage that there's no
worry about file formats. Whatever version of Excel you're running,
it can open the text file. This method *could* work in LibreOffice
too, but unfortunately the macro command used in AutoOpen.xls doesn't
exist in LO BASIC. The command is Workbooks.OpenText

I'm not sure if the problem is that OpenText doesn't exist, or if
there is no Workbooks object to begin with. The documentation on LO
BASIC is so sparse that I can't find anything about opening
spreadsheets. The LO help file promises documentation at
OpenOffice.org; but clicking that link takes me instead to
https://wiki.documentfoundation.org/Documentation/BASIC_Guide, which
is a placeholder page containing only a link to another
website--which doesn't respond.

The BASIC-Guide is still on

http://wiki.openoffice.org/wiki/Documentation/BASIC_Guide

You might also want to look at
http://wiki.openoffice.org/wiki/Documentation/DevGuide/Basic/OpenOffice.org_Basic

Old, but in parts still useful is "StarOffice 8 Programming Guide for BASIC". It is no longer available from Oracle, but you will find it on the web.

And you need "IDL Reference Complete LibreOffice 4.0 API reference". It is in the SDK or use it online http://api.libreoffice.org/docs/common/ref/com/sun/star/module-ix.html




(By the way, the help file does document an Open command, but that
command is used to open simple data files to be processed and closed
by the script. It doesn't cause LO to open a document in the UI.)

The help has a lot of commands, which do not fit to modern systems. The simple file access commands no longer work, never use them.


After finding nothing documented, I enabled macro recording, began
recording a macro, and used File > Open to open the text
file/spreadsheet myself. Obviously, I was hoping to then examine the
macro to learn what objects and functions LO uses to open files.

The macro recorder uses the dispatcher. You cannot learn from it to write own macros.

 But
opening a new file causes macro recording to end without a comment,
warning, or error…and without saving anything of the macro in
progress.

Can anyone give me clues to creating a macro which can open a
spreadsheet?

Kind regards
Regina



--
Unsubscribe instructions: E-mail to discuss+help@documentfoundation.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.documentfoundation.org/www/discuss/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.