How to run a macro contained inside a template when new document created

Hello,

I have a macro that I inserted into a template file (.ott).
I went to Tools / Customize and choose to run this macro when document is opened.
In order to check if the macro is actually ran, I added a Msgbox at the beginning of execution.

When I double click on it, it opens a new document (.odt) but the macro is not launched.

Is it something that can be done ? If yes, can you tell me how ? Because it seems that I didn’t do it the right way…

Thanks for your help.

I found the answer : I have to add the macro to the “new document” event