Hi
I have an multiuser excel workbbook, with autosave set to "ON" as default.
I wan't the workbook to close if autosave is set to "OFF"
How can I make this code work?![]()
Please Login or Register to view this content.
Hi
I have an multiuser excel workbbook, with autosave set to "ON" as default.
I wan't the workbook to close if autosave is set to "OFF"
How can I make this code work?![]()
Please Login or Register to view this content.
I didnt find a proprierty to check for autosave.
Try this code, this will close the workbook if it is not saved.
Since the first time you open a workbook it is not saved, if you set this when the workbook is opened it will close it.
![]()
Please Login or Register to view this content.
"Good Morning, Good Evening and Good Night"
In Thisworkbook moduleArtik![]()
Please Login or Register to view this content.
Thank you
It should work all time workbook is open, not before close?
I have used the code in a timer, but in only works on start up, not if workbook is already open.
(Timer on workbook open, starting code in module, looping the code every 5 sec)
From the first post, I understood that you do not want to allow the closure of the Workbook when AutoSave is OFF. In contrast, from the last post, it appears that you want to make the AutoSave switch always be ON. Now I don't know exactly what you care about.
Artik
Hi
Thank you for your answer.
I want the workbook to close, if someone set the autosave to off
Regards
Tony
Here is a couple different bits of code that will close the workbook. The first 1 only saves then closes the workbook. The second one saves the workbooks, then closes Excel. This code needs to be put in the Workbook_SheetSelectionChange event, not the Worksheet_SelectionChange event, (although that would work too, but would only apply to that sheet and not the entire workbook. It would still require the user to click into any cell for it to close, but it works. If you want to go back to putting it into a timer routine, that would work too.
So here's the 2 codes:
![]()
Please Login or Register to view this content.
Also, here's a sample file in case that helps. Click on any cell and it will close if Autosave is off.
Thank you for the answer
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks