View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
oli merge oli merge is offline
external usenet poster
 
Posts: 50
Default Application.enableevents = false not working in workbook open even

Hi,

I have some code I want to run on opening a workbook that populates a
multiselect listbox with some values without triggering other macros that are
stored in events. Basically as the open workbook code populates the listbox,
some other code I have that is set to trigger on the listbox change event
that writes the values to some cells kicks in and puts all the values except
the first to blank before the open workbook code finishes.

I thought putting "Application.enableevents = false" at the start of the
openworkbook code and "Application.enableevents = true" at the end would stop
this, but its not working. After some reading I was wondering whether its
actually the worksheet trying to load the object that triggers the listbox
change event, not the workbook open event, and that this is running before
the workbook change?

Whats the best solution here, could I have a global variable that prevents
the listbox change event from doing anything until the workbook open event
has run?