Word 2010 vba - controls that resize on their own

User avatar
kdock
5StarLounger
Posts: 720
Joined: 21 Aug 2011, 21:01
Location: The beautiful hills of Western North Carolina

Word 2010 vba - controls that resize on their own

Post by kdock »

This is an issue that I've seen off an on over the years, but have never quite known what to do about except tweak until it all stays stable.

I have a userform with a frame. In that frame, I've created five rows of three controls each: a text control for name, a text control for date, and a check box to determine whether the name should be included or not. Beneath each of the check boxes is an empty text box which changes color when the check box has focus (otherwise you can't tell).

The frame has a vertical scroll and only two of the five lines are visible at any one time.

My issue is that when the userform is displayed, line 3, which is revealed either through scrolling or just tabbing from the end of line 2, is visibly smaller.
resizing controls.png
Lines 4 and 5 display the same as lines 1 and 2.

Are there any magic words or other techniques available to prevent this spontaneous resizing? The text and check boxes look fine in the vbe (although sometimes this issue will occur there, too).

Thanks! Kim
You do not have the required permissions to view the files attached to this post.
"Hmm. What does this button do?" Said everyone before being ejected from a car, blown up, or deleting all the data from the mainframe.

User avatar
kdock
5StarLounger
Posts: 720
Joined: 21 Aug 2011, 21:01
Location: The beautiful hills of Western North Carolina

Re: Word 2010 vba - controls that resize on their own

Post by kdock »

Well, I took another look in the vbe and sure enough, the third line IS smaller there, too. I've made the check box 16x16 rather than 15x15 and that seems to have handled it, but the text boxes are still shrinking. I'll try making them just a tiny bit bigger (their outline makes the grey lines between fields, so I'll have to be subtle...).

Still, if anyone knows why this happens (positioning? bad kharma?) I'd love to know.

Thanks,
Kim
"Hmm. What does this button do?" Said everyone before being ejected from a car, blown up, or deleting all the data from the mainframe.

User avatar
HansV
Administrator
Posts: 78487
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Word 2010 vba - controls that resize on their own

Post by HansV »

I can reproduce the problem - it seems to occur only when the frame is sized so that the bottom visible row fits exactly. If I increase or decrease the height of the fame slightly (0.5 points is enough), the shrinking disappears.

I haven't been able to find anything about this problem...
Best wishes,
Hans

User avatar
kdock
5StarLounger
Posts: 720
Joined: 21 Aug 2011, 21:01
Location: The beautiful hills of Western North Carolina

Re: Word 2010 vba - controls that resize on their own

Post by kdock »

Thanks Hans, neither have I and I'm surprised since I've seen it often enough.

I was able to fix line 3 by making the text boxes just a tiny bit taller. But I've seen this issue in design mode when simply moving controls around on a userform. Occasionally one will just shrink and nudging it up or down will make it display correctly.

I'll try your workaround so all my controls can be consistent.

Best, Kim
"Hmm. What does this button do?" Said everyone before being ejected from a car, blown up, or deleting all the data from the mainframe.