Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving a control in a userform
Hi everybody,
I would like to know how I could to allow a user to move a control (image) in a userform. Thanks Pierre |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Moving a control in a userform
Thanks but I forgot to mention that the user uses only the mouse.
I also would like the mouse pointer to switch to a WE arrow when it reaches the right end of the image and then be able to resize it while dragging towards the left side. Thank you Pierre "Bob Phillips" a écrit dans le message de ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
moving on userform | Excel Discussion (Misc queries) | |||
Userform control | Excel Programming | |||
Userform control | Excel Programming | |||
UserForm Control | Excel Programming | |||
UserForm Control | Excel Programming |