Macro to restart Windows

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Kofi
Posts: 2
Joined: Mon Feb 25, 2019 5:02 pm

Macro to restart Windows

Post by Kofi »

Hello,

I would like to create a macro to restart Windows when launching a calc file. How do you do that? I can't reuse my VBA script for Microsoft word.

Thank you in advance
OpenOffice 5.3.9.10 on Windows Vista
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Macro to restart Windows

Post by JeJe »

I tested the code in the last post and it worked on my Windows 8 machine.

https://www.experts-exchange.com/questi ... VB6-0.html

(I googled - vb6 restart windows - and it was the first result. VB6 is very similar too OOBasic but has a much bigger code base so if you google VB6 along with what you're looking for you might easily find it)
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Kofi
Posts: 2
Joined: Mon Feb 25, 2019 5:02 pm

Re: Macro to restart Windows

Post by Kofi »

Thanks JeJe, it works great

I assigned the execution of the macro to open the file but I can't assign it only to my file. Now as soon as I open a calc spreadsheet, the macro is executed.

How do I make a macro that runs when I open my document only?
OpenOffice 5.3.9.10 on Windows Vista
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Macro to restart Windows

Post by JeJe »

Go to Tools/customize/events and set the macro to the Open document event for your document only. The "save in" combo at the bottom lets you set the macro for your document only.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Post Reply