D
dmcmullen
Stephen Lebans' A2KVerticalJustify.zip
(http://www.lebans.com/verticaljustification.htm) works great for
vertically centering text boxes that have a fixed height (CanGrow=No),
but how can I vertically center a text box if CanGrow=Yes? Then the
following Sub blows up when the text box height grows beyond the
original size (ctl.Height):
Private Sub VerticallyCenter(ctl As Control)
Dim lngHeight As Long
lngHeight = fTextHeight(ctl)
' Rounding will cause a 1 or 2 pixel margin of error
ctl.TopMargin = ((ctl.Height - lngHeight) / 2)
End Sub
(http://www.lebans.com/verticaljustification.htm) works great for
vertically centering text boxes that have a fixed height (CanGrow=No),
but how can I vertically center a text box if CanGrow=Yes? Then the
following Sub blows up when the text box height grows beyond the
original size (ctl.Height):
Private Sub VerticallyCenter(ctl As Control)
Dim lngHeight As Long
lngHeight = fTextHeight(ctl)
' Rounding will cause a 1 or 2 pixel margin of error
ctl.TopMargin = ((ctl.Height - lngHeight) / 2)
End Sub