K. Georgiadis
03-24-2005, 01:24 PM
I have an Activex control (combo box) with the following code:
Private Sub cboPrice_Change()
Range("C2").Value = cboPrice.Value
End Sub
Because of a glitch in Excel SP3, control boxes jump to the left each time Print Preview is selected. The work around is to right click each control, select Format Control > Properties and then click "Move and size with cells."
The Macro recorder reports that the code for these formatting steps is:
Sub AnchorControl()
ActiveSheet.Shapes("cboPrice").Select
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
End Sub
Obviously, it would be just simple (in fact simpler) to format my four or five controls with a few mouse clicks but, in the interest of learning, wouldn't it be OK to include the formatting code in the event handler?
Private Sub cboPrice_Change()
Range("C2").Value = cboPrice.Value
End Sub
Because of a glitch in Excel SP3, control boxes jump to the left each time Print Preview is selected. The work around is to right click each control, select Format Control > Properties and then click "Move and size with cells."
The Macro recorder reports that the code for these formatting steps is:
Sub AnchorControl()
ActiveSheet.Shapes("cboPrice").Select
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
End Sub
Obviously, it would be just simple (in fact simpler) to format my four or five controls with a few mouse clicks but, in the interest of learning, wouldn't it be OK to include the formatting code in the event handler?