Closing application problem

S

Sandy

Hi,
Excel 2007 - Two simple macros.
(I would suggest trying these out).

Private Sub Workbook_Open()

Application.DisplayFullScreen = True
Application.DisplayFormulaBar = False

End Sub

Private Sub Workbook_BeforeClose(cancel As Boolean)

Application.DisplayFullScreen = False
Application.DisplayFormulaBar = True

End Sub

The problem is that when a change has been made to the workbook and the user
clicks cancel when the save dialog appears there is then no option to close
down the application.

Is there any way to force the entire application window to be viewed in
order that the close button can be selected.

Sandy
 
C

Clarindo

Try it,


Private Sub Workbook_BeforeClose(cancel As Boolean)
If Not ActiveWorkbook.Saved Then
If (MsgBox("Save the work?", vbYesNo)) = 6 Then
ActiveWorkbook.Save
Else
ActiveWorkbook.Saved = True
End If
Application.DisplayFullScreen = False
Application.DisplayFormulaBar = True
End If
End Sub
 
S

Sandy

Hi Clarindo
This certainly takes the 'Cancel' aspect out of the options.
Thank you it works well.
Sandy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top