Forum Discussion

zorgnum's avatar
zorgnum
Brass Contributor
Aug 08, 2023
Solved

My userforms intermittenly lose focus and disappear when performing tasks on worksheets

hi all, this has been happening for quite a while now and I have been searching the independent excel support sites and nobody seems to have a reliable fix for this. My userform has controls that perform tasks across a number of worksheets and occasionally, the userform loses focus and disappears from the workspace.

 

Does anyone have a method to prevent the focus being lost from the userform?

2 Replies

    • zorgnum's avatar
      zorgnum
      Brass Contributor
      Hi, your suggestion was working fine but, Microsoft sent a windows update in the last week and my main userform is now doing very strange things, it's almost like it has 2 copies of the form open, clicking the exit button doesn't close the form, keeps focus, then the form closes on the second click. I've started building a replacement userform which runs some code that takes a while to complete. Intermittently, there is a white band that flashes across the top of the screen, too fast for me to catch what it says. I used xbox gamebar to try to record the message but it didn't show the userform or the error message, although they both happened. Now, do you happen to know a command that I can embed into my code to make it look like excel is still running?

Resources