View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JimRWR JimRWR is offline
external usenet poster
 
Posts: 18
Default Triggering Change_Events after Form Initialization

Hi.

I have a form whose controls are created and populated at runtime. I also
have two class modules, each of which handles a change_event for a particular
control. I received the Runtime Error 91: Variable or With block variable
not set. Having read several posts supressing form-level events, I created a
module-level, public Boolean variable in order to turn change_events on and
off. This has resolved the Runtime error, and all controls are now created
and populated. At this point, changing a combobox value should trigger its
change_event. However, even though I've turned the events back on at the end
of the module, nothing happens. Below is relevant code:

<module level
Public ChangePrice as Boolean
Sub Edit()
ChangePrice = False 'disables change_events
<Form initialized, controls created and populated.
ChangePrice = True 'enables change_events

<class module
Sub ctrl1_Change()
If ChangePrice = True then
cls(1).ctrl1.value = something
Else
Exit Sub
End If
End Sub

Why doesn't the change_event fire after I enable it?

TIA,

Jim