Strange behaviour

A

Anthony

Excel 2007

I have workbook with a workbook.open event, which sets up the workbook and
ensures certain pages are visible.

If I open this workbook first every runs fine and the code for activate and
deactivate works well when opening another file.

If I open up another file first, the first time I run the workbook with the
workbook.open event it runs exactly as its suppose to.

If I then close the file with the events and leave the other workbook active
(It has some macros but no workbook.open or activate deactivate events) and
then re-open the workbook with workbook.open event, the event doesn't run.

I have put debug.print code in a certain points and it shows the number of
items run getting less and less

first run shows

workbook.open
workbook.activate

2nd run

workbook.activate


3rd run


(nothing run)


Anyone with any ideas?
 
G

Gord Dibben

I would look for code in the "other" workbook that disables events and does
not re-enable events.

In either book do you have any error trap that exits sub without re-enabling
events?


Gord Dibben MS Excel MVP
 
A

Anthony

hi,

I had the same thought as I was writing the message. You are right. I had
turned of the events to stop the before close event triggering again as the
workbook closed.

After some fiddling I have solved the problem.

Thank you.

Regards

Anthony
 
A

Anthony

hi,

I had the same thought as I was writing the message. You are right. I had
turned of the events to stop the before close event triggering again as the
workbook closed.

After some fiddling I have solved the problem.

Thank you.

Regards

Anthony
 
A

Anthony

hi,

I had the same thought as I was writing the message. You are right. I had
turned of the events to stop the before close event triggering again as the
workbook closed.

After some fiddling I have solved the problem.

Thank you.

Regards

Anthony
 

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