Hi Andreas,

Andreas Schlüns a écrit :
> The basic property "ThisComponent" is'nt a realy stable feature.
> It referrs to the "current document" ... and that can be the problem
> here. Do you realy know which of your documents is the "current one" at
> the time you call "ThisComponent.getTextFields()" ?
> 
> In general "ThisComponent" should be used only in the following case:
> (my personal opinion !)
> 
> a) You have one document containing macros.
> b) You register these macros to the event "OnLoad", so they are started
> automaticly.
> c) Then ThisComponent referrs to THESE document.
> d) You dont open any other document or do any action, which can set

What about the event onCreate of a template ?

> Why do you spread the code of "one operation" on two documents ?
> Might be you should make it more explicit. How ?

I think I don't understand really your question here. The macro is
simply launched when a new document is created from a template. This
template has a registered macro on the onCreation event.

When creating the document using File > New > Documents and Templates,
everything works fine. But when creating the document from another
macro, it doesn't work. I already tested if it wasn't a misuse of the
ThisComponent, but I got the correct document.

> You should know which frames/models are interesting for you and use it
> explicitly. E.g. the desktop service provides easy access to every open
> frame. You can iterate over all these frames and search for your and all
> other interesting models there. Or you cache all opened documents
> (opened by your basic macro) and forward these references to all the
> code you trigger ...

Thus is there any way to get the reference of the document which called
the macro ? I would be sure to get the correct document this way.

Thanks for your help,
Cedric

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to