Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic code

Status
Not open for further replies.

VulcanJedi

Technical User
Oct 2, 2002
430
US
I know without some pretty involved doing in Excel but curious if object model of OpenOffice supports?
Can you dynamically create code in openoffice?

For example: can you have a script that will create a NEW openoffice calc spreadsheet and then subsequently have code saved in it? Such as and OpenBook event where nextime someone opened it some other code would run?

[yinyang] Tranpkp [pc2]
 
Take a look at LibreOffice.

It's the way to go, going forward, for open source office suites. It's a branch off of OpenOffice, and most of its staff and such are those who were the main contributors to OpenOffice, best I recall.

Anyway, download it, install it, and take a look at the scripting menu, I think it is... or another, I forget the specific one. I'm at work right now, so I don't have access to LibreOffice, only MS Office.

I noticed recently (in clicking around) that LibreOffice supports VBA (MS Office programming), php, and a few others, I forget the specifics right now, but I know I want to find the time to play around in it a little bit.
 
Oh, by the way, I'm not sure how far that "support" for VBA goes, so don't quote me on that. [wink] After all, I'd doubt that Microsoft would allow a competitor to directly license the VBA object models.
 
In my experience, VBA macros do not run in OO or LO for the most part. To access the document/spreadsheet object model, you need to reference some API (whose name I can't recall).

_________________
Bob Rashkin
 
I'm sorry I dont think you all our understanding the question. My question is I am well away of the opensource forking of OO to LO which doesnt remotely have anything to do w/ my question.

Both offer some sort of VBA support but otherwise have their own object models.
What my question is:
Can you DYNAMICALLY create code in LibreOffice?
For example can you programatically generate a brand new file, and embed code in that file?
Such as create brand new stinking.xls
embed code in there such as Openbook event module that would "hello world" when opening that file?
IE basically self generating code that would be local to the file itself.

This was not possible in Excel without some craziness which would not be feasible.

[yinyang] Tranpkp [pc2]
 
I think you're not understanding your own question, quite frankly.

Here's you're question:
I know without some pretty involved doing in Excel but curious if object model of OpenOffice supports?
Can you dynamically create code in openoffice?

For example: can you have a script that will create a NEW openoffice calc spreadsheet and then subsequently have code saved in it? Such as and OpenBook event where nextime someone opened it some other code would run?

The reason I mentioned LibreOffice is that it is highly possible you did not know about it. Since it's a new product, it's possible you would be referring to it rather than OpenOffice. Whichever you want to go with, however, I'd suggest you specify that one. So for the remainder of this thread, I'll just assume OpenOffice.

Now to break down the details:
==>I know without some pretty involved doing in Excel but curious if object model of OpenOffice supports?
1. That question is so grammatically incorrect, I can't begin to ensure I understand it. My guess is you're asking 1 of 2 things:
1. Does OpenOffice support the MS Office Object Model? or..
2. Does OpenOffice have it's own built-in Object Model?

==>Can you dynamically create code in openoffice?
Make sure you understand the definition of dynamic code, and that you understand what you're asking here. If you think you understand what you're asking, please clarify. One possible reference

==>
For example: can you have a script that will create a NEW openoffice calc spreadsheet and then subsequently have code saved in it? Such as and OpenBook event where nextime someone opened it some other code would run?

So, are you wanting to just click a button, and the program create it's own programmed scripting automatically? Or are you talking more-so about setting up the scripting the same/similar way you would do in Excel? In Excel, for instance, you would create the workbook (as of MS Office 2007, specifically an .xlsb workbook - macro enabled), put whatever code in it where you want, according to your need/desire, save it... then when opened (if in the workbook_open event), it would execute. Or if you wnated it to be a template, of course, you'd save that as a macro-enabled template.

Is that what you're after? Where YOU set up the code, or are you looking for it to record the code like the macro recording tool in MS Office?

In OpenOffice, to record a macro:

For the On Open event, here's one reference I found:

Otherwise, you need to clarify your question.
 

==>
YES! It is clear. Any of these such examples would suffice.
Like I said dynamically generated code, where a script genereated code that is embedded and saved locally within a workbook.

For example: can you have a script that will create a NEW openoffice calc spreadsheet and then subsequently have code saved in it? Such as and OpenBook event where nextime someone opened it some other code would run?
So, are you wanting to just click a button, and the program create it's own programmed scripting automatically? Or are you talking more-so about setting up the scripting the same/similar way you would do in Excel? In Excel, for instance, you would create the workbook (as of MS Office 2007, specifically an .xlsb workbook - macro enabled), put whatever code in it where you want, according to your need/desire, save it... then when opened (if in the workbook_open event), it would execute. Or if you wnated it to be a template, of course, you'd save that as a macro-enabled template.

[yinyang] Tranpkp [pc2]
 
How far have you dug into it yourself? You seem to be asking is scripting events possible in OpenOffice? Isn't that about like asking Can a Duck float on water?

I don't know, maybe I'm just missing something. If I am, I'm sure someone will come along with a better answer. But I still think you've just not tried. If you're really interested, the software is free, easy to install and setup. I'm assuming you've tried at least something in OpenOffice.

Otherwise, if I get a chance away from work in the near future (as I don't have it at work), I might try to look at both OpenOffice and LibreOffice on the scripting options. It's soemthing I've been wanting to do anyway... just not enough time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top