• DisplayFullscreen=False doesn’t work (Excel 97/2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » DisplayFullscreen=False doesn’t work (Excel 97/2000)

    Author
    Topic
    #362212

    I must do something wrong, but I really can’t find out what. I have an application that starts a quality quiz, that is, when started, a userform is used to guide the user through a questionnaire, a kind of quiz, allowing him/her to know how much he/she knows about quality, in general. To hide the Excel environment, I use a few statements in the Workbook_Open which I undo in the Workbook_BeforeClose event. The Workbook_BeforeClose event is triggered by ActiveWorkbook.Close which is apart from the unload me command, the only command executed when the OK button on the UserForm is clicked.

    Private Sub CmdOK_Click()
      Unload Me
      ActiveWorkbook.Close
    End Sub
    
    Private Sub Workbook_Open()
       ActiveWindow.DisplayGridlines = False
       Application.DisplayFullScreen = True
       UserForm1.Show
    End Sub
    
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
       ActiveWindow.DisplayGridlines = True
       Application.DisplayFullScreen = False
       Application.Quit
    End Sub
    

    My problem is that when I start up Excel again after the quiz has been run, the DisplayFullScreen is still True, although I set it to false before quitting. The user should click the Close Fullscreen button before he has the normal situation again.
    Does anyone know why this DisplayFullscreen is not reset?

    Viewing 1 reply thread
    Author
    Replies
    • #549513

      Hans,

      I do not know why Application.DisplayFullScreen = False does not seem to fire in the close event, especially as the the Gridlines are turned back on. However if you place the line of code in CmdOK_Click() before ActiveWorkbook.Close it seems to work fine. I know you would like an explanation, but none occurs just now. Maybe somebody has encountered this before.

      Have you considered Application.Visible = False and the back on with =True. It does not inhibit the display of userforms.

      Andrew

    • #549588

      Hi Hans,

      I reprodused your problem. Workaround:
      Remove the workbook_beforeclose sub and change the button_click eventprocedure to this:

      Private Sub CommandButton1_Click()
          Unload Me
          ActiveWindow.DisplayGridlines = True
          Application.DisplayFullScreen = False
          ActiveWorkbook.Saved = True
          Application.Quit
      End Sub
      
      • #549591

        Thanks Jan Karel and Andrew,

        These are both nice workarounds that are alternatives for what I wanted to do. As Andrew said, it does not tell me why my original code does not work. Anyhow, I don’t want to loose time to find out the ‘whys’ of MS. Thanks again..

        • #549601

          Hi Hans,

          If you add
          MSGBOX “Closing”
          to the workbook_beforeclose event, you see that this event does not get triggered when caused by the close method in the buttonclick event (the message box does not show up).

          • #549615

            Jan Karel,

            I followed that recommendation but the messagebox appeared AND the displayfullscreen was NOT set to false. Strange isn’t it? (using Excel 2000, English version now).

    Viewing 1 reply thread
    Reply To: Reply #549615 in DisplayFullscreen=False doesn’t work (Excel 97/2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel