Consulting

Results 1 to 4 of 4

Thread: Solved: Exit and Exit Full Screen

  1. #1

    Solved: Exit and Exit Full Screen

    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.

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

    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

  2. #2
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    [vba]application.displayfullscreen = false[/vba]

    But I would have expected that to be triggered by the BeforeClose event from here: http://www.vbaexpress.com/forum/showthread.php?t=33737
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  3. #3
    Quote Originally Posted by Ken Puls
    [vba]application.displayfullscreen = false[/vba]

    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!

    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?

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

    [/VBA]

    Thanks yet again Ken

    Andy

  4. #4
    Quote Originally Posted by Andybuck86
    Hi Ken,

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

    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?

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

    [/vba]

    Thanks yet again Ken

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •