View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson[_4_] Greg Wilson[_4_] is offline
external usenet poster
 
Posts: 218
Default Before "Before Close" help needed!

Suggestion is that you insert the statement "DoEvents" in
the sub procedure just after it unhides the worksheets;
or, alternatively, at the appropriate point in the
Before_Close event code.

Regards,
Greg
(VBA amateur)

-----Original Message-----
Hi

Have a workbook that "before close" needs to export

several of its sheets to
a new workbook, create a pivot table in that workbook,

close and save the
new work book, then get on with closing itself. I have

all the code to deal
with this and it works well by itself. However I also run

the first workbook
from a set of buttons on the first sheet. One of these is

an Exit button,
which saves and closes the workbook. I have also set the

Before Close event
in the workbook to do the same thing, so that the user

has to save and
close, which ever way they try to close the workbook.

My problem is that introducing the sub procedure in

the "before close" event
to deal with the export. For some reason, it doesn't

work. What is happening
in the "before close" event that is different from normal?

e.g. my sub needs to unhide 4 worksheets to in order to

export them. This
does not happen when run from within the "before close"

sub on the workbook.

Hope this all makes sense?

Joe

.