Article ID: 111899
Article Last Modified on 10/11/2006
When <Control>.Left It snaps is set to this value to this value ---------------------------------------- 0 0 0.25 0 0.50 0 0.75 0.75 1.00 0.75 1.25 0.75 1.50 1.50If you try to set the Left property of a control to 1.12 or 1.25, for example, Microsoft Excel will snap the control's Left property to 0.75, because that is the greatest multiple of 0.75 less than or equal to 1.12 or 1.25.
Control Type Units Snapped to
-----------------------------------------------------------------------
ALL CONTROLS The Left property of all controls snaps to the
nearest multiple of 0.75 less than or equal to the
indicated value.
The Top property of all controls snaps to the
nearest multiple of 0.75 less than or equal to the
indicated value.
Edit Boxes The Height property of edit boxes and labels use
and Labels the following table to determine the true Height
value:
Height Set to Height Snaps to
-------------------------------
0.00 - 18.50 13.50
18.75 - 28.25 23.25
28.50 - 38.00 33.00
38.25 - 47.75 42.75
For subsequent ranges, add 9.75 for each range.
The Width property of edit boxes and labels snaps to
the nearest multiple of 0.75 less than or equal to
the indicated value.
Buttons The Height property of buttons snaps to the nearest
multiple of 0.75 less than or equal to the indicated
value, but no less than 15.75.
The Width property of buttons snaps to the nearest
multiple of 0.75 less than or equal to the indicated
value, but no less than 3.00.
Dialog Box Frame All properties of a dialog frame snap to the nearest
multiple of 0.75 less than or equal to the indicated
value.
Group Boxes The Height property of group boxes snaps to the
nearest multiple of .75 less than or equal to the
indicated value, but no less than 18.75.
The Width property of group boxes snaps to the
nearest multiple of 0.75 less than or equal to the
indicated value, but no less than 23.25.
Check Boxes The Height property of check boxes is always 16.50.
The Width property of check boxes snaps to the
nearest multiple of 0.75 less than or equal to the
indicated value, but no less than 23.25.
Option Buttons The Height property of option buttons is always
16.50.
The Width property of option buttons snaps to the
nearest multiple of 0.75 less than or equal to the
indicated value, but no less than 23.25.
List Boxes The Height property of list boxes uses the following
table to determine the true Height value:
Height Set to Height Snaps to
-------------------------------
0.00 - 26.75 21.75
27.00 - 36.50 31.50
36.75 - 46.25 41.25
46.50 - 56.00 51.00
For subsequent ranges, add 9.75 for each range.
The Width property of list boxes snaps to the
nearest multiple of 0.75 less than or equal to the
indicated value, but no less than 12.00.
Drop-Down Lists The Height property of drop-down lists is always
15.00.
The Width property of drop-down lists snaps to the
nearest multiple of 0.75 less than or equal to the
indicated value, but no less than 12.00.
Drop-Down Edit The Height property of drop-down edit boxes is always
Boxes 13.50.
The Width property of drop-down edit boxes snaps to
the nearest multiple of 0.75 less than or equal to
the indicated value, but no less than 12.00.
Scroll Bars The Height property of scroll bars snaps to the
nearest multiple of 0.75 less than or equal to the
indicated value, but no less than 12.00.
The Width property of scroll bars is always 12.00.
Spinners The Height property of spinners snaps to the nearest
multiple of 0.75 less than or equal to the indicated
value, but no less than 13.50.
The Width property of spinners is always 9.00.
'---------------------------------------------------------------------- Sub ControlSnapDemo() 'Add a new dialog sheet to the active workbook. Set DemoDlg = ThisWorkbook.DialogSheets.Add 'Add an edit box to the current dialog sheet. The dimensions 'supplied are arbitrary. Set EdBox = DemoDlg.EditBoxes.Add(50, 50, 50, 50) 'Set the Top, Left, Height, and Width properties of the edit box. EdBox.Top = 50 EdBox.Left = 70 EdBox.Height = 15 EdBox.Width = 80 'Construct a message string which will be shown in a message box. 'Chr$(9) is a tab character: Chr$(10) is a line feed. MsgString = Chr$(9) & "Original Setting" & Chr$(9) & "Snaps To" MsgString = MsgString & Chr$(10) & "Top" & Chr$(9) & "50" & Chr$(9) MsgString = MsgString & Chr$(9) & EdBox.Top & Chr$(10) & "Left" MsgString = MsgString & Chr$(9) & "70" & Chr$(9) & Chr$(9) MsgString = MsgString & EdBox.Left & Chr$(10)& "Height" & Chr$(9) MsgString = MsgString & "15" & Chr$(9) & Chr$(9) & EdBox.Height MsgString = MsgString & Chr$(10) & "Width" & Chr$(9) & "80" & Chr$(9) MsgString = MsgString & Chr$(9) & EdBox.Width 'Show the message. MsgBox MsgString End Sub '----------------------------------------------------------------------When you run this subroutine, a new dialog sheet containing a new edit box will be created. A message box will appear with this message:
Original Setting Snaps To
Top 50 47.25
Left 70 69.75
Height 15 13.5
Width 80 79.5
The "snap to" values in Microsoft Excel 97 may vary slightly from the "snap
to" values in Microsoft Excel 5.x and 7.x. The "snap to" values in
Microsoft Excel 97 will tend to vary less from the original settings than
previous versions of Microsoft Excel.
Additional query words: 97 xl97 XL
Keywords: kbprogramming KB111899