Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Strange behaviour

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Strange behaviour

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


On Fri, 26 Mar 2010 21:03:23 -0000, "Anthony"
wrote:

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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Strange behaviour

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

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
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


On Fri, 26 Mar 2010 21:03:23 -0000, "Anthony"
wrote:

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?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Strange behaviour

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

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
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


On Fri, 26 Mar 2010 21:03:23 -0000, "Anthony"
wrote:

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?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Strange behaviour

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

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
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


On Fri, 26 Mar 2010 21:03:23 -0000, "Anthony"
wrote:

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?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
strange behaviour sunilpatel Excel Programming 1 May 15th 09 12:22 AM
strange behaviour Risky Dave Excel Programming 1 November 26th 08 01:57 AM
Strange if(***) behaviour? Excel 2003 - SPB Excel Discussion (Misc queries) 6 August 6th 06 05:34 PM
Strange VBA Behaviour Ricko Excel Programming 0 July 28th 05 07:53 AM
Strange behaviour Edgar Thoemmes Excel Worksheet Functions 1 February 8th 05 03:20 PM


All times are GMT +1. The time now is 04:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"