Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
moving on userform Zygan Excel Discussion (Misc queries) 1 July 27th 06 08:54 AM
Userform control ZMore Excel Programming 1 March 5th 04 11:34 PM
Userform control Phillips Excel Programming 1 November 20th 03 07:33 PM
UserForm Control John Wilson Excel Programming 0 July 16th 03 06:53 PM
UserForm Control Richard Choate Excel Programming 0 July 16th 03 06:50 PM


All times are GMT +1. The time now is 02:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"