Page 1 of 1

[Solved] Start a macro when file is open

Posted: Tue Oct 12, 2010 12:04 pm
by florin
Hello

1. I want to run a macro when the file is open (in Calc). How can I do this ? (Workbook_Open in excel)

2. If the macro security is set to high how can I close the file after it is open (if it is not possible do not open the file; or display an empty tab).

Thanks
Florin

Re: Start a macro when file is open

Posted: Tue Oct 12, 2010 5:44 pm
by JohnV
One Calc file or every Calc file?

Re: Start a macro when file is open

Posted: Tue Oct 12, 2010 10:21 pm
by Zizi64
1. I want to run a macro when the file is open (in Calc). How can I do this ?
Here is an example.

This is a minimal macro:

Code: Select all

Sub Run_at_open
Print "This macro runs when this file opened"
End Sub
The macro located in this file:
Run_at_opening.ods
(8.12 KiB) Downloaded 1723 times
Setting of Open Document event:
Start_macro.png

Re: Start a macro when file is open

Posted: Wed Oct 13, 2010 6:42 am
by florin
Just one Calc file.
Thank you all.

Re: Start a macro when file is open

Posted: Wed Oct 13, 2010 4:57 pm
by JohnV
Was this enough to solve your problem?

Re: Start a macro when file is open

Posted: Thu Oct 14, 2010 6:54 am
by florin
Yes, thank you.