Option Compare Database Option Explicit Public X As Single, Y As Single, wide As Single, high As Single Sub getsSizeFrom(ByVal c As Control) 'get my size from a control X = c.Left Y = c.Top wide = c.Width high = c.Height End Sub Sub SetPlain(px As Single, py As Single, ph As Single, pv As Single) 'get my size from values X = px Y = px wide = ph high = pv End Sub Sub SetCopy(ByVal r As MyRectangle) 'get my size from another rectangle X = r.X Y = r.Y wide = r.wide high = r.high End Sub Sub Sizes(c As Control) 'copy my size TO a control c.Left = X c.Top = Y c.Width = wide c.Height = high End Sub Function Shifted(px As Single, py As Single) As MyRectangle 'return an offset rectangle Dim r As New MyRectangle r.SetCopy Me r.MoveBy px, py Set Shifted = r End Function Function MoveBy(px As Single, py As Single) X = X + px Y = Y + py End Function Function Within(bounds As MyRectangle, Optional bConfine = False) As MyRectangle 'force within a rectangle if bConfine=true 'otherwise, code meant to do something different but I don't understand that anymore Dim bRes As Boolean, r As New MyRectangle bRes = True r.SetCopy Me If bConfine Then r.X = Max(bounds.X, Min(X, bounds.wide - r.wide)) r.Y = Max(bounds.Y, Min(Y, bounds.high - r.high)) Else bRes = bRes And (X > bounds.X) bRes = bRes And (Y > bounds.Y) bRes = bRes And (X + wide < bounds.X + bounds.wide) bRes = bRes And (Y + high < bounds.Y + bounds.high) End If Set Within = r End Function Sub dbprint() 'for debugging only Debug.Print X; Y; wide; high End Sub Function RectOf(ByVal c As Control) As Rectangle 'ROUTINE : RectOf 'PURPOSE : find valid area in form for a control 'INPUT : Control C: control to check 'OUTPUT : rectangle: area found 'USES : SetPlain 'EFFECT : . Dim r As New MyRectangle, F As Form Set F = c.Parent r.SetPlain 0, 0, F.InsideWidth, F.Section(c.Section).Height - 10 'the -10 is about line width, I guess. It didn't work without Set RectOf = r End Function