[Solved] Start a macro when file is open

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
florin
Posts: 3
Joined: Tue Oct 12, 2010 11:51 am

[Solved] Start a macro when file is open

Post 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
Last edited by Hagar Delest on Thu Oct 14, 2010 12:49 pm, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice.org 3.2
Windows XP Professional
JohnV
Volunteer
Posts: 1585
Joined: Mon Oct 08, 2007 1:32 am
Location: Kentucky, USA

Re: Start a macro when file is open

Post by JohnV »

One Calc file or every Calc file?
User avatar
Zizi64
Volunteer
Posts: 11511
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Start a macro when file is open

Post 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
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
florin
Posts: 3
Joined: Tue Oct 12, 2010 11:51 am

Re: Start a macro when file is open

Post by florin »

Just one Calc file.
Thank you all.
OpenOffice.org 3.2
Windows XP Professional
JohnV
Volunteer
Posts: 1585
Joined: Mon Oct 08, 2007 1:32 am
Location: Kentucky, USA

Re: Start a macro when file is open

Post by JohnV »

Was this enough to solve your problem?
florin
Posts: 3
Joined: Tue Oct 12, 2010 11:51 am

Re: Start a macro when file is open

Post by florin »

Yes, thank you.
OpenOffice.org 3.2
Windows XP Professional
Post Reply