Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Userform runs other subs when initialized

In trying to solve a problem with a user form, I began to suspect that
multiple subs were being triggered as soon as I showed the form. I put
a MsgBox into each sub in the code section of my userform, except for
Userform_Initialize. The form has two multicolumn list boxes, two combo
boxes, and three command buttons. Both listboxes and one combobox have
change event subs. When I initially call up this userform (from a
button in a Worksheet) the message box in the combobox change event sub
appears once, the message box in one listbox appears twice, and the
other appears three times! Is this normal behavior? Could this be why
my listbox selection values are being cleared unexpectedly?
I would really appreciate any help on this matter.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Userform runs other subs when initialized

Try using the click event rather than the change event.

--
Regards,
Tom Ogilvy


"zipdog" wrote in message
oups.com...
In trying to solve a problem with a user form, I began to suspect that
multiple subs were being triggered as soon as I showed the form. I put
a MsgBox into each sub in the code section of my userform, except for
Userform_Initialize. The form has two multicolumn list boxes, two combo
boxes, and three command buttons. Both listboxes and one combobox have
change event subs. When I initially call up this userform (from a
button in a Worksheet) the message box in the combobox change event sub
appears once, the message box in one listbox appears twice, and the
other appears three times! Is this normal behavior? Could this be why
my listbox selection values are being cleared unexpectedly?
I would really appreciate any help on this matter.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Userform runs other subs when initialized

Thanks very much for responding. I have actually used both click and
change. Same effect. I have overcome the initial problem using an
event suppression solution from Dick Kusleika. Thanks, Dick! I also
changed the first procedure from initialize to activate, though I am
unclear what the difference is.

It still seems weird to me that change and especially click events fire
during Initialization. Even though I am please that I got my program
to work, I would still love to understand what's going on with
initialize, activate, and how they affect the values in listbox
controls.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Userform runs other subs when initialized

It depends on what you are doing in the Initialize and Activate events.

Using a boolean public variable is useful in many cases (but not all) to
block events from running.

--
Regards,
Tom Ogilvy


"zipdog" wrote in message
ups.com...
Thanks very much for responding. I have actually used both click and
change. Same effect. I have overcome the initial problem using an
event suppression solution from Dick Kusleika. Thanks, Dick! I also
changed the first procedure from initialize to activate, though I am
unclear what the difference is.

It still seems weird to me that change and especially click events fire
during Initialization. Even though I am please that I got my program
to work, I would still love to understand what's going on with
initialize, activate, and how they affect the values in listbox
controls.



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
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs Rruffpaw Setting up and Configuration of Excel 1 September 17th 11 01:25 PM
ImageList must be initialized What-a-Tool Excel Programming 6 October 27th 04 12:39 AM
Keping a UserForm open as VBA runs Chris Gorham[_3_] Excel Programming 3 December 26th 03 09:02 PM
Excel: VBA userform is shown but not loaded/initialized even though it was first unloaded? Luisa[_2_] Excel Programming 2 December 5th 03 08:15 AM
listbox value not initialized John Holland Excel Programming 2 November 25th 03 07:57 PM


All times are GMT +1. The time now is 01:16 AM.

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"