Form control event loses connection to Form

starl

Administrator
Joined
Aug 16, 2002
Messages
5,969
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
I have a VBA userform with a listbox that I've added scroll code to. Works great on my test machines, but on one machine, after a little time, it debugs.
I use a MouseMove event over the listbox to trigger some code. The code triggers, but when it gets to the line
VBA Code:
Me.ActiveControl = Me.lb_Feedlist
(just a way to check if the control that triggered the code is the feedlist), it debugs and when I look,
VBA Code:
Me = Nothing
.
At first I thought it was a script that runs on the machine every 2 minutes - it opens a new instance of Excel and does some stuff in the background. So, I disabled the script - but the debug still happened.
There is also another program (non-Excel) that runs on the machine. Admittedly, I have had issues remoting into that machine because of that program. When it updates, it does take control of the machine.
I'm assuming that's what is happening, but I can't figure out why the program would forget what Me is. Or, most importantly, how I can workaround this and reinstate Me.
For now, I've disabled all scroll code - and the workbook works fine on that machine.
One thing I haven't tried is skipping the event if Me = Nothing, in hopes that it will reinstate itself. Anyone know enough about what goes on in the background with events and the Mouse API to give me insight?
 

Some videos you may like

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Watch MrExcel Video

Forum statistics

Threads
1,127,009
Messages
5,622,145
Members
415,881
Latest member
tasic89

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top