Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way to allow a user to move (drag and drop) a text box or a label
on an open form? I want the user to be able to place a "note" on the form, but once the box opens, I need them to be able to move it around on the page similar to the way one can move a Post It note. I am running Excel 2003. Tony |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Tony, Where are these objects? On a worksheet or a VBA UserForm? Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=50104 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tony
Here on a Userform, dragging Label1 around: Option Explicit ' *********** top pof module ************ Dim x0 As Long, y0 As Long Private Sub Label1_MouseDown(ByVal Button As Integer, _ ByVal Shift As Integer, _ ByVal X As Single, ByVal Y As Single) x0 = X y0 = Y End Sub Private Sub Label1_MouseMove(ByVal Button As Integer, _ ByVal Shift As Integer, _ ByVal X As Single, ByVal Y As Single) If Button = 1 Then Label1.Top = Label1.Top + Y - y0 Label1.Left = Label1.Left + X - x0 End If End Sub HTH. Best wishes Harald "Tony" wrote in message ... Is there a way to allow a user to move (drag and drop) a text box or a label on an open form? I want the user to be able to place a "note" on the form, but once the box opens, I need them to be able to move it around on the page similar to the way one can move a Post It note. I am running Excel 2003. Tony |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Harald -
Pretty cool, as always. I made some refinements to keep the label within the confines of the userform: ''''''''''''''''''''''''''' Option Explicit Dim x0 As Long, y0 As Long Private Sub Label1_MouseDown(ByVal Button As Integer, _ ByVal Shift As Integer, _ ByVal X As Single, ByVal Y As Single) x0 = X y0 = Y End Sub Private Sub Label1_MouseMove(ByVal Button As Integer, _ ByVal Shift As Integer, _ ByVal X As Single, ByVal Y As Single) Dim x1 As Long, y1 As Long If Button = 1 Then x1 = Label1.Left + X - x0 If x1 < 0 Then x1 = 0 If x1 Me.InsideWidth - Me.Label1.Width Then x1 = Me.InsideWidth - Me.Label1.Width End If y1 = Label1.Top + Y - y0 If y1 < 0 Then y1 = 0 If y1 Me.InsideHeight - Me.Label1.Height Then y1 = Me.InsideHeight - Me.Label1.Height End If Label1.Left = x1 Label1.Top = y1 End If End Sub ''''''''''''''''''''''''''' - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services, Inc. http://PeltierTech.com/WordPress/ _______ "Harald Staff" wrote in message ... Hi Tony Here on a Userform, dragging Label1 around: Option Explicit ' *********** top pof module ************ Dim x0 As Long, y0 As Long Private Sub Label1_MouseDown(ByVal Button As Integer, _ ByVal Shift As Integer, _ ByVal X As Single, ByVal Y As Single) x0 = X y0 = Y End Sub Private Sub Label1_MouseMove(ByVal Button As Integer, _ ByVal Shift As Integer, _ ByVal X As Single, ByVal Y As Single) If Button = 1 Then Label1.Top = Label1.Top + Y - y0 Label1.Left = Label1.Left + X - x0 End If End Sub HTH. Best wishes Harald "Tony" wrote in message ... Is there a way to allow a user to move (drag and drop) a text box or a label on an open form? I want the user to be able to place a "note" on the form, but once the box opens, I need them to be able to move it around on the page similar to the way one can move a Post It note. I am running Excel 2003. Tony |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Concatenate to form a label | Excel Discussion (Misc queries) | |||
Hyperlink on a label in a VB Form | Excel Discussion (Misc queries) | |||
Form label not showing | Excel Programming | |||
COPY LABEL FORM FROM EXCEL TO A LABEL | New Users to Excel | |||
Disable Label in a Form | Excel Programming |