mark99k
11-17-2012, 08:54 AM
Hi. I'm trying to duplicate, in a userform, the common behavior of a multiple-approach box -- for example, the Left Indent box in the Paragraph dialog, where you can change the value by either (1) editing it directly, (2) clicking the adjacent spin buttons, or (3) clicking within the box and pressing the up or down arrow keys.
The spin buttons work fine, but my attempted code for the arrow keypresses (below, simplified) does nothing. Is that box truly a combo box, or is it some other type of control, married to internal spin buttons? Thanks for any clues.
Sub LI_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 38 Then
Call LISpin_SpinUp
ElseIf KeyAscii = 40 Then
Call LISpin_SpinDown
End If
End Sub
Sub LISpin_SpinUp
LI.Text = Str(Val(LI.Text) + 1)
End Sub
Sub LISpin_SpinDown
LI.Text = Str(Val(LI.Text) - 1)
End Sub
The spin buttons work fine, but my attempted code for the arrow keypresses (below, simplified) does nothing. Is that box truly a combo box, or is it some other type of control, married to internal spin buttons? Thanks for any clues.
Sub LI_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 38 Then
Call LISpin_SpinUp
ElseIf KeyAscii = 40 Then
Call LISpin_SpinDown
End If
End Sub
Sub LISpin_SpinUp
LI.Text = Str(Val(LI.Text) + 1)
End Sub
Sub LISpin_SpinDown
LI.Text = Str(Val(LI.Text) - 1)
End Sub