Moving a control in a userform
Pierre,
Add up and down, left and right buttons, and change the position. Here's
some code, it is a bit slow so you may want to try a spinner
Const hInc As Long = 4
Const vInc As Long = 4
Const hLeft As Long = 20
Const hRight As Long = 200
Const vTop As Long = 20
Const vBottom As Long = 300
Private Sub cmdLeft_Click()
With Me.Controls("Textbox1")
If .Left = hLeft Then
.Left = .Left - hInc
End If
End With
End Sub
Private Sub cmdRight_Click()
With Me.Controls("Textbox1")
If .Left <= hRight Then
.Left = .Left + hInc
End If
End With
End Sub
Private Sub cmdUp_Click()
With Me.Controls("Textbox1")
If .Top = vTop Then
.Top = .Top - vInc
End If
End With
End Sub
Private Sub cmdDown_Click()
With Me.Controls("Textbox1")
If .Top <= vBottom Then
.Top = .Top + vInc
End If
End With
End Sub
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Pierre Archambault" wrote in message
...
Hi everybody,
I would like to know how I could to allow a user to move a control (image)
in a userform.
Thanks
Pierre
|