Workbook Shut Down without Saving problem

G Marshall

Board Regular
Joined
Dec 31, 2002
Messages
134
Hi there

Within an excel workbook I have a visual basic code that shuts the workbook down following a period of inactivity. I have the workbook password protected so that I am the only person who can change anything. All other users only need to view the workbook.

Sub ShutDown()
CreateObject("WScript.Shell").Popup _
"Due to inactivity this workbook is now closing", 2, "ATTENTION"
ThisWorkbook.Close
End Sub

This works fine except that prior to it closing down automatucally, excel asks if I want to save any changes and until I click no in that dialog box the system will not close.

I can set the file properties to ‘read only’ but before it closes automatically it tells me that the file is read only and do I want to save it under a new name.

Is there any way that I can close the workbook down without saving and without the system asking if I want to save it.

Appreciate any help


Gerald
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Add the display alert command
Code:
Sub ShutDown()
Application.DisplayAlerts = False
CreateObject("WScript.Shell").Popup _
"Due to inactivity this workbook is now closing", 2, "ATTENTION"
ThisWorkbook.Close
Application.DisplayAlerts = True
End Sub
 
Upvote 0
Hi texasalynn

A big Thanks for that information, it worked perfectly. Dont know how I'd survive without this forum!

Cheers (y)


Gerald
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

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