Page 1 of 1
Macro to restart Windows
Posted: Mon Feb 25, 2019 5:08 pm
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
Re: Macro to restart Windows
Posted: Mon Feb 25, 2019 9:58 pm
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)
Re: Macro to restart Windows
Posted: Tue Feb 26, 2019 11:50 am
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?
Re: Macro to restart Windows
Posted: Tue Feb 26, 2019 11:55 am
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.