AlexanderBB
Well-known Member
- Joined
- Jul 1, 2009
- Messages
- 1,953
- Office Version
- 2019
- 2016
- Platform
- Windows
I've struck a bit of a nasty. It's taken a few days to isolate the problem but I'm not sure how to fix it.
It's starts in my Worksheet change event. This reads a checkbox in an unloaded Form to determine whether to run the change event code, or not.
The line is " If frmConfig.chkAutoEdit = true then..."
On stepping through with F8 you can see this runs frmConfig UserForm_Initialize(). I don't want this so have a Global Boolean variable set True and the first line there is "If EnterInhibit = True Then Exit Sub." (This is later set back to False.)
So far so good, but then the problem starts. The next time frmConfig is Opened (with command "frmConfig.Show") UserForm_Initialize() does not run. Stepping through shows it doesn't even try! The form still opens but because Initialise hasn't run it's all a mess.
It isn't anything to do with my Global boolean as that's not checked.
It's like my reading chkAutoEdit has flagged the Initialise event to not run the next time it should.
Is there a reason for this behaviour and what would be the best fix or workaround, please.
Thanks for any help. I need it !!!
Rgds, ABB
It's starts in my Worksheet change event. This reads a checkbox in an unloaded Form to determine whether to run the change event code, or not.
The line is " If frmConfig.chkAutoEdit = true then..."
On stepping through with F8 you can see this runs frmConfig UserForm_Initialize(). I don't want this so have a Global Boolean variable set True and the first line there is "If EnterInhibit = True Then Exit Sub." (This is later set back to False.)
So far so good, but then the problem starts. The next time frmConfig is Opened (with command "frmConfig.Show") UserForm_Initialize() does not run. Stepping through shows it doesn't even try! The form still opens but because Initialise hasn't run it's all a mess.
It isn't anything to do with my Global boolean as that's not checked.
It's like my reading chkAutoEdit has flagged the Initialise event to not run the next time it should.
Is there a reason for this behaviour and what would be the best fix or workaround, please.
Thanks for any help. I need it !!!
Rgds, ABB