G
Greg Wilson
I've been pestered of late by what appears to be a
ShrinkToFit effect respecting text boxes on a MultiPage.
I recall encountering this in the past also.
In this case, the text boxes are tightly spaced. I don't
know if it is a requirement for the text boxes be on a
MultiPage and/or tightly spaced.
The following code will create a userform, add a MultiPage
and several tightly spaced text boxes. I believe it will
replicate the phenomenon for others.
I find that if the MultiPage height is set to 358, for
instance, the 11th level of textboxes appear to have type
7 font while the others are type 8. If I change the
height to either 356 or 359 it changes to the 4th level.
If I change it to 357 or 360 the problem goes away. Other
combinations of component dimensions/positions can also
effect this. Hoping someone can explain the logic.
Running xl2000.
Sub ShrinkToFitOddity()
Dim i As Integer, ii As Integer
Dim UF As Object, TB As Control, Multi As MultiPage
Set UF = Application.VBE. _
ActiveVBProject.VBComponents.Add(3)
UF.Properties("Height") = 400
UF.Properties("Width") = 130
Set Multi = UF.Designer.Controls.Add("Forms.MultiPage.1")
With Multi
..Height = 358 'Note effect when 356, 357, 358, 359 and 360
..Width = 115
..Top = 5
..Left = 5
End With
For i = 1 To 20
For ii = 0 To 1
Set TB = Multi.Pages(0).Controls.Add("Forms.TextBox.1")
With TB
..Font.Size = 8
..Left = 10 + ii * 50
..Top = i * 15 + 11
..Height = 15
..Width = 40
..Text = Format(Rnd, "0.00")
End With
Next ii
Next i
End Sub
TIA,
Greg
ShrinkToFit effect respecting text boxes on a MultiPage.
I recall encountering this in the past also.
In this case, the text boxes are tightly spaced. I don't
know if it is a requirement for the text boxes be on a
MultiPage and/or tightly spaced.
The following code will create a userform, add a MultiPage
and several tightly spaced text boxes. I believe it will
replicate the phenomenon for others.
I find that if the MultiPage height is set to 358, for
instance, the 11th level of textboxes appear to have type
7 font while the others are type 8. If I change the
height to either 356 or 359 it changes to the 4th level.
If I change it to 357 or 360 the problem goes away. Other
combinations of component dimensions/positions can also
effect this. Hoping someone can explain the logic.
Running xl2000.
Sub ShrinkToFitOddity()
Dim i As Integer, ii As Integer
Dim UF As Object, TB As Control, Multi As MultiPage
Set UF = Application.VBE. _
ActiveVBProject.VBComponents.Add(3)
UF.Properties("Height") = 400
UF.Properties("Width") = 130
Set Multi = UF.Designer.Controls.Add("Forms.MultiPage.1")
With Multi
..Height = 358 'Note effect when 356, 357, 358, 359 and 360
..Width = 115
..Top = 5
..Left = 5
End With
For i = 1 To 20
For ii = 0 To 1
Set TB = Multi.Pages(0).Controls.Add("Forms.TextBox.1")
With TB
..Font.Size = 8
..Left = 10 + ii * 50
..Top = i * 15 + 11
..Height = 15
..Width = 40
..Text = Format(Rnd, "0.00")
End With
Next ii
Next i
End Sub
TIA,
Greg