Monday, 29 July 2024

How to Shut down your computer using user form command button // Shut down your computer using VBA code

 Follow the below Number steps for shut down your computer directly when you click the command button. If you want to know how to create a Command Button then open the MS Excel and fallow step.

A) open developer tab

      If developer tab is not look then click the MS Office logo and click the Excel options and check ✅ show Developer tab in the Ribbon .





B) click the Visual Basic.



C) click the Insert User Form 



D) select the command button in open Tool Box and draw the command button in open User Form.



Step 1:- 

            First you create a Command Button in MS Excel User Form. Then dibble click the command button.


Step 2:-

           Write the below code 



Start code 

On error resume next 

Activeworkbook.save

Application.DisplayAlert = false 

Application.Quit

Shell " Shutdown -s -t 30 "

End code 


Step 3:-

             When you complete the code , then click the run command. Your MS Excel sheet save automatically in your computer and other functions is closed automatically within 30 seconds and your computer is Shut down properly.



No comments:

Post a Comment

Synthesis process of thiol || Advance organic synthesis Method

  Synthesis process of thiol (RSH): -   Synthesis process of thiol (RSH):-                                                                In...