pcc
Well-known Member
- Joined
- Jan 21, 2003
- Messages
- 1,357
I have a userform with several togglebuttons. Each togglebutton has some code that runs using the ToggleButton1_MouseMove procedure - (the code involves activating a sheet and geting a list of values for entry into a textbox).
Once the 'Go' button is clicked, the main procedure runs to get data from an Access database, process it and write the result tio a new workbok. However, if the user moves the cursor over one of the togglebuttons while the main prcedure is running, an error occurs, as the ToggleButton1_MouseMove attempts to run. I want to arrange it so that this code is disabled when the main procedure is running. I guess I may be able to use Application.EnableEvents = False, but I wondor if there is a better way than this. If I set it to False, I need to make sure that it's set back to True at the end, and this has the problem that if there is an untrapped error, and the code errors out, then the user will be left in the Application.EnableEvents = False state, which I want to avoid.
Any ideas how to achieve this easily?
Once the 'Go' button is clicked, the main procedure runs to get data from an Access database, process it and write the result tio a new workbok. However, if the user moves the cursor over one of the togglebuttons while the main prcedure is running, an error occurs, as the ToggleButton1_MouseMove attempts to run. I want to arrange it so that this code is disabled when the main procedure is running. I guess I may be able to use Application.EnableEvents = False, but I wondor if there is a better way than this. If I set it to False, I need to make sure that it's set back to True at the end, and this has the problem that if there is an untrapped error, and the code errors out, then the user will be left in the Application.EnableEvents = False state, which I want to avoid.
Any ideas how to achieve this easily?