View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
E.Anderegg E.Anderegg is offline
external usenet poster
 
Posts: 12
Default i'm stuck with an excel qujitting problem

Hello
I have a Worksheets with several vba macros. When a user opens it, it
displays only a dialog (sort of welcome disclaimer), and when the user
clicks ok, the rest of the worksheets are made visible.
This works .
Tomake sure that a startup no other ecxel windows are displayed, I created a
before_Close routine, which hides all open windows of the workbook and then
saves it.

Closing the workbook works fine.
Quitting excel hides and saves the workbook, but does not close Excel!!!
I have to quit excel a second time, which then works.
What's wrong ??
Any help is appreciated

Ernst


Code at startup:

Private Sub Workbook_Open()
Frm_Intro.Show
ThisWorkbook.Windows(1).Visible = True
ThisWorkbook.Worksheets("Input").Visible = True
etc

at close:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
For Each Window In ThisWorkbook.Windows
Window.Visible = False
Next
ThisWorkbook.Save