I have 2 combo boxes on the same sheet and both have Combobox_Change() event
code associated with them. This code resides in the sheet object (same
sheet) and both macros call other routines in a module in this same
spreadsheet file. When one of these events fires, I want to inhibit the
other from firing while the first's code is executing. I've tried using
Application.EnableEvents = False, but it's just ignored. Does anyone know
why this would be?
Thanks,
Will
Changes to these controls aren't affected by application.enableevents settings
(as you've seen).
But you could do the same sort of thing...
Dim BlkProc as boolean
private sub combobox1_change()
if blkproc = true then exit sub
'rest of your code here
end sub
private sub combobox2_change()
if blkproc = true then exit sub
'rest of your code here
blkproc = true
'some code that would cause combobox1_change to fire
blkproc = false
end sub
roadkill wrote:
gt;
gt; I have 2 combo boxes on the same sheet and both have Combobox_Change() event
gt; code associated with them. This code resides in the sheet object (same
gt; sheet) and both macros call other routines in a module in this same
gt; spreadsheet file. When one of these events fires, I want to inhibit the
gt; other from firing while the first's code is executing. I've tried using
gt; Application.EnableEvents = False, but it's just ignored. Does anyone know
gt; why this would be?
gt;
gt; Thanks,
gt; Will
--
Dave Peterson
Thanks - that worked just fine. What events DOES the EnableEvents setting
affect?
quot;Dave Petersonquot; wrote:
gt; Changes to these controls aren't affected by application.enableevents settings
gt; (as you've seen).
gt;
gt; But you could do the same sort of thing...
gt;
gt; Dim BlkProc as boolean
gt;
gt; private sub combobox1_change()
gt; if blkproc = true then exit sub
gt; 'rest of your code here
gt; end sub
gt;
gt;
gt;
gt; private sub combobox2_change()
gt; if blkproc = true then exit sub
gt; 'rest of your code here
gt; blkproc = true
gt; 'some code that would cause combobox1_change to fire
gt; blkproc = false
gt;
gt; end sub
gt;
gt; roadkill wrote:
gt; gt;
gt; gt; I have 2 combo boxes on the same sheet and both have Combobox_Change() event
gt; gt; code associated with them. This code resides in the sheet object (same
gt; gt; sheet) and both macros call other routines in a module in this same
gt; gt; spreadsheet file. When one of these events fires, I want to inhibit the
gt; gt; other from firing while the first's code is executing. I've tried using
gt; gt; Application.EnableEvents = False, but it's just ignored. Does anyone know
gt; gt; why this would be?
gt; gt;
gt; gt; Thanks,
gt; gt; Will
gt;
gt; --
gt;
gt; Dave Peterson
gt;
- May 16 Wed 2007 20:37
Events won't Disable!
close
全站熱搜
留言列表
發表留言