Hi Guys
Can anyone please help me to write vba code for "when we click on a commandbutton then close the excel application in 10 seconds."
Thanks
Hi Guys
Can anyone please help me to write vba code for "when we click on a commandbutton then close the excel application in 10 seconds."
Thanks
Hi,
How about this?
You may get a window pop up saking "Do you want to save the changes.."![]()
Sub due() Application.Wait Now + TimeValue("00:00:10") Application.Quit End Sub
To supress this,
![]()
Sub due() Application.DisplayAlerts=False Application.Wait Now + TimeValue("00:00:10") Application.Quit End Sub
Rule 1: Never merge cells
Rule 2: See rule 1
"Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".
That works gr8. Thanks Sweep. Can you also tell me how to close the excel application if someone is not using it for about 20 minutes. That means some times people just open the application and don't do anything with this for a long time . Is it possible to close it automatically if the person is not using it for about 20 minutes.
Last edited by aman1234; 08-26-2010 at 06:33 AM.
Yes,
This code goes in the workbook area of the VBA editor.
and this goes in a standard module![]()
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Dim sCountDownTime As String Application.OnTime Now + TimeValue("0:20:00"), "ShutDown" End Sub
Note that changes made won't be saved, unless you remove the ' from the above code.![]()
Sub shutdown() Application.DisplayAlerts = False 'ActiveWorkbook.Save Application.Quit End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks