Application.EnableEvents undefined (converted Excel macros)

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
GaryAitken
Posts: 5
Joined: Wed Jul 02, 2008 6:50 am

Application.EnableEvents undefined (converted Excel macros)

Post by GaryAitken »

Which version of OpenOffice.org are you using?2.4.1
What Operating System (version) are you using?Win2K

I converted an Excel spreadsheet which contained macros which used the Application.EnableEvents feature of VBA.
The converted macros contained the following two lines at the start of the module:

Rem Attribute VBA_ModuleType=VBADocumentModule
Option VBASupport 1

The spreadsheet contained a control (button) which called one of the macros for a click event.
I tentatively mapped the mouse up event to the appropriate macro.

When attempting to interpret the macros, the following statement

Application.EnableEvents = False

results in an error dialog:

BASIC runtime error.
Property or method not found.

If I uncomment the "Attribute..." line,
I get the error dialog with the following:

BASIC syntax error.
Expected: Sub.

The dialog appears to be posted 4 separate times. I don't see any indication in the editor window of which line the error pertains to, although it is scrolled to the end of the module.

Can someone point me to a discussion of information on conversion of documents which use VBA globals such as the Application object?
Does OO BASIC mimic these VBA globals? My searches turned up empty.

Thanks for any pointers.
User avatar
TheGurkha
Volunteer
Posts: 6482
Joined: Thu Mar 13, 2008 12:13 pm
Location: North Wales, UK.

Re: Application.EnableEvents undefined (converted Excel macros)

Post by TheGurkha »

I can't help personally but this is a very good reference for Macros and OOBasic.

Andrew Pitonyak's OpenOffice.org Macro Document, updated May 12, 2008.
Ubuntu 14.10 Utopic Unicorn, LibreOffice Version: 4.3.3.2
Gurkha Welfare Trust
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Application.EnableEvents undefined (converted Excel macros)

Post by Villeroy »

VBA support may work with very trivial macros. A macro which needs to turn on and off event handlers is not trivial. Both office suits have a fundamentally different architecture. There is no equivalent to VBA's EnableEvents in this office suite.
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
satupe@gmail.com
Posts: 4
Joined: Tue Nov 23, 2010 2:24 am

Re: Application.EnableEvents undefined (converted Excel macr

Post by satupe@gmail.com »

I have had difficulty finding code snippets for simple Excel VBA conversion to OO. I have created a web page for beginning OO developers who, like me, are having trouble finding code snippets. Check out this link =>http://sites.google.com/site/satuperail/home
OpenOffice.org 3.2.1 Linux (Ubuntu 10.10)
Post Reply