PDA

View Full Version : Solved: Exit and Exit Full Screen



Andybuck86
08-24-2010, 12:47 PM
Hi,

My third post after two very successful posts yesterday!

I have a button in a spreadsheet that when pressed, will exit the spreadsheet without saving.

Sub CloseNoSave()
'Close the workbook without saving it
ThisWorkbook.Close savechanges:=False
End Sub

I have a VBA that will put excel in full screen mode (hide all of the toolbars) when entering the spreadsheet.

What do I need to do to my code to enable full screen again before exiting?

Many thanks for any help


Andy

Ken Puls
08-24-2010, 01:22 PM
application.displayfullscreen = false

But I would have expected that to be triggered by the BeforeClose event from here: http://www.vbaexpress.com/forum/showthread.php?t=33737

Andybuck86
08-24-2010, 01:34 PM
application.displayfullscreen = false

But I would have expected that to be triggered by the BeforeClose event from here: http://www.vbaexpress.com/forum/showthread.php?t=33737

Hi Ken,

Yes, sorry - my earlier post related to the standard exit button which now, thanks to you works perfectly! :bow:

Now I have created an exit button which will close the document without saving when pressed. However, like my last post I now need to include the code to restore the toolbar.

To put it another way - currently when I exit through the red X at the top right the toolbar restores before closing the worksheet. But when I press my new button the worksheet closes but the toolbars are not restored.

I did try the code you have just suggested but not sure where to put it in my existing code?


Sub CloseNoSave()
'Close the workbook without saving it
ThisWorkbook.Close savechanges:=False
End Sub



Thanks yet again Ken

Andy

Andybuck86
08-24-2010, 01:45 PM
Hi Ken,

Yes, sorry - my earlier post related to the standard exit button which now, thanks to you works perfectly! :bow:

Now I have created an exit button which will close the document without saving when pressed. However, like my last post I now need to include the code to restore the toolbar.

To put it another way - currently when I exit through the red X at the top right the toolbar restores before closing the worksheet. But when I press my new button the worksheet closes but the toolbars are not restored.

I did try the code you have just suggested but not sure where to put it in my existing code?


Sub CloseNoSave()
'Close the workbook without saving it
ThisWorkbook.Close savechanges:=False
End Sub



Thanks yet again Ken

Andy

Your code worked a treat - can't thank you enough