BeforeClose VBA Question??

  • Thread starter Don G - ExcelForums.com
  • Start date
D

Don G - ExcelForums.com

Hi folks

First, if Vasant is reading this, I'd like to thank him for some hel
he posted to me in the MS Excel forums. I received his answer, i
worked fine, but then was unable to log back on to that forum....an
haven't been ever since. Anyway.....Thanks Vasant...appreciate you
help.... :)

Now the current problem. I have a WorkBook, let's call i
WorkBook(1), that both opens and closes with code.....pasted below

Private Sub Workbook_Open(
Application.DisplayFullScreen = Tru
Application.ScreenUpdating = Fals
With ActiveWindo
.DisplayHeadings = Fals
.DisplayOutline = Fals
.DisplayHorizontalScrollBar = Fals
.DisplayVerticalScrollBar = Fals
.DisplayWorkbookTabs = Fals
End Wit
With Applicatio
.DisplayFormulaBar = Fals
.DisplayStatusBar = Fals
End Wit
Application.CommandBars("Standard").Visible
Fals
Application.CommandBars("Formatting").Visible
Fals
Application.CommandBars("Drawing").Visible
Fals
End Su

Private Sub Workbook_BeforeClose(Cancel As Boolean

Application.DisplayFullScreen = Fals
Application.ScreenUpdating = Tru
With ActiveWindo
.DisplayHeadings = Tru
.DisplayOutline = Tru
.DisplayHorizontalScrollBar = Tru
.DisplayVerticalScrollBar = Tru
.DisplayWorkbookTabs = Tru
End Wit
With Applicatio
.DisplayFormulaBar = Tru
.DisplayStatusBar = Tru
End Wit
Application.CommandBars("Standard").Visible
Tru
Application.CommandBars("Formatting").Visible
Tru
Application.CommandBars("Drawing").Visible
Fals
Saved = Tru
Application.Qui

End Su


What I've tried to do is keep as many of the tool bars etc away fro
the op as much as possible. All data is entered through a DataFor
that opens with a click of a button. Also, to explain some of th
above code, none of the data is to be saved, it's merely printed ou
on a form by way of one of several macros

Within Workbook(1) there is a msgbox (Y/N) that pops up at define
intervals, allowing the op to either continue working with a "Y
response or quit WorkBook(1) and Excel with a "N" response. Msgbo
code below

[code:1:129092220e]Sub EndProg(

' Closes Exce
' Macro written 5/12/2005 by D

Dim Msg, Style, Title, Help, Ctxt, Response, MyStrin
Msg = "Would you like to print another form?
Style = vbYesNo + vbQuestio
Title = "Estimated Billing Form Query
Response = MsgBox(Msg, Style, Title, Help, Ctxt
If Response = vbYes The
MyString = "Yes
Sheets("INTRO").Selec
Els
MyString = "No
Workbooks("EstimatedBillingForms4").Clos
SaveChanges:=Fals
End I
End Su
[/code:1:129092220e

Problem is when Workbook(1) and Excel close, using the msgbox "N", an
you re-open Excel to a new or different WorkBook, the sheet-tabs ar
not visible. They are checked in the Options box but do not show o
the sheet. Unchecking and re-checking them again has no affect

However, if you open Workbook(1), then click on the "X" (upper righ
corner), Workbook(1) and Excel close properly, and the next openin
of Excel is fine...shows the sheet tabs

Any help here would be greatly appreciated

Do

....Looks like this thing got double posted...not sure how, but it'
in here twice.....sorry about that
 

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