Auto Save and Close VBA Issue

Wardylewis

New Member
Joined
Jun 7, 2016
Messages
37
Good Morning All,

I have been having issues with a shared sheet in terms ofpeople leaving it open on their desktop for hours on end and not using it.

I had found some code which worked and required a timer to bestarted upon opening the sheet and then the code below being placed in to amodule.

My issue is that whilst it works in its job of closing thesheet, it has had many other issues mainly around the ribbon and toolbarsfreezing and not functioning as the code was running all the time. It also doesn’tallow people to print as it keeps saying searching for printers.

I would have to manually break the code but didn't want totell everyone this as it then defeats the object.

Is there any way i can prevent this from happening.

Your assistance is greatly appreciated.
<!--[if !supportLineBreakNewLine]-->
Code:
'Countdown for the save and close the sheet.
 
'Used for auto save and close after inactivity.
Const idleTime = 900 'seconds
Dim Start
Sub StartTimer()
   Start = Timer
   Do While Timer < Start + idleTime
        DoEvents
    Loop
    Application.DisplayAlerts = False
    ActiveWorkbook.Close SaveChanges:=True
    Application.DisplayAlerts = True
   
              
   
End Sub

Thanks Lewis

<!--[endif]-->
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top