I have the following, seemingly trivial, VBA code:
ctrl.Top = offset
ctrl
is an options group control on a form. offset
is an integer variable. I am using the debugger to step through the code line by line. Using watches, I observe the following values:
Before the line of code:
ctrl.Top: 3670
offset: 4170
After the line of code:
ctrl.Top: 3820
offset: 4170
I have tried the following:
offset = 6170
--> ctrl.Top = 3820
(No change)offset = 2170
--> ctrl.Top = 2170
(Now it's correct)offset = 3821
--> ctrl.Top = 3820
(No change)ctrl.Top = 3671
before the code --> ctrl.Top = 3821
after (??)At first I thought that ctrl.Top
might have some kind of limit, but the last test suggests otherwise. Is there any mechanism, layout, restriction or anything that could cause such a behavior? I honestly don't even know where to start looking.
I was able to eventually figure out what the problem was. As I mentioned in the question, the control is an options group control. Naturally, that group contains buttons to select an option. As it turns out, moving an option group will not move its contents along and you are not allowed to move the group past it's content. So any attempt to move the options group past the option buttons resulted in the position getting clipped.