Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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.

    <pre>Private Sub CmdOK_Click()
    Unload Me
    ActiveWorkbook.Close
    End Sub
    </pre>


    <pre>Private Sub Workbook_Open()
    ActiveWindow.DisplayGridlines = False
    Application.DisplayFullScreen = True
    UserForm1.Show
    End Sub
    </pre>


    <pre>Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ActiveWindow.DisplayGridlines = True
    Application.DisplayFullScreen = False
    Application.Quit
    End Sub
    </pre>


    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?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: DisplayFullscreen=False doesn't work (Excel 97/2000)

    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

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DisplayFullscreen=False doesn't work (Excel 97/2000)

    Hi Hans,

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

    <pre>Private Sub CommandButton1_Click()
    Unload Me
    ActiveWindow.DisplayGridlines = True
    Application.DisplayFullScreen = False
    ActiveWorkbook.Saved = True
    Application.Quit
    End Sub
    </pre>

    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  4. #4
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DisplayFullscreen=False doesn't work (Excel 97/2000)

    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..

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DisplayFullscreen=False doesn't work (Excel 97/2000)

    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).
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  6. #6
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DisplayFullscreen=False doesn't work (Excel 97/2000)

    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).

  7. #7
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DisplayFullscreen=False doesn't work (Excel 97/2000)

    You're right of course, didn't test thoroughly.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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