[api-dev] Fom basic: to assign a macro to event: 'Document closed'

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[api-dev] Fom basic: to assign a macro to event: 'Document closed'

Bart Aimar-2
Hi all.

I need to modify programmatically the current document by assigning a
macro to event: Document Closed

 From GUI would:

Tools > Customize > Tab Events > Document closed > assigne Macro

can I make this from basic?


thanks in advanced

Bart Aimar
Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] Fom basic: to assign a macro to event: 'Document closed'

Oliver Brinzing
Hi,

you will find more information here:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Document_Events

OPTION EXPLICIT

Sub setDocEvent()

        Dim oDoc as Object
        Dim mEvt(1) as New com.sun.star.beans.PropertyValue

        oDoc = ThisComponent

        mEvt(0).Name = "EventType"
        mEvt(0).Value= "Script"
        mEvt(1).Name = "Script"
        mEvt(1).Value ="vnd.sun.star.script:Standard.Module7.test?language=Basic&location=application"

    oDoc.getEvents().replaceByName("OnPrepareUnload", mEvt())

End Sub


Regards

Oliver

--

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45


signature.asc (268 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [api-dev] From basic: to assign a macro to event: 'Document closed'

Bart Aimar-2
Il 15/01/2011 09:55, Oliver Brinzing ha scritto:
> Hi,
Hi Oliver
> you will find more information here:
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Document_Events
Good!
and here the events list:
http://api.openoffice.org/docs/common/ref/com/sun/star/document/Events.html
> Sub setDocEvent()
> ..zoot...
Excellent! Exactly what I need!

Thank you!

Bart Aimar

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]