Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using userforms alot for data entry.
Is there a way to allow one to drag and drop text from one text box / combo box to another? This would be especially useful since it would allow me to move entered data down or up within the userform during editing. However i cannot drag text from one box to another (as one can in say word or in the sheet itself). Can anyone help? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is very basic just to get you started. There's a lot more you will
probably want to do, also slightly different approaches - '' put some text in Textbox1 '' press left button and hold Ctrl with mouse over Textbox1 '' drag and release over Textbox2 Private msText As String Private Sub TextBox1_BeforeDragOver( _ ByVal Cancel As MSForms.ReturnBoolean, _ ByVal Data As MSForms.DataObject, _ ByVal X As Single, ByVal Y As Single, _ ByVal DragState As MSForms.fmDragState, _ ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer) Cancel = True End Sub Private Sub TextBox1_MouseDown(ByVal Button As Integer, _ ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = 1 And Shift = 2 Then Set dataObj = New MSForms.DataObject msText = TextBox1.Text dataObj.StartDrag End If End Sub Private Sub TextBox1_MouseUp(ByVal Button As Integer, _ ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) msText = "" End Sub Private Sub TextBox2_BeforeDragOver( _ ByVal Cancel As MSForms.ReturnBoolean, _ ByVal Data As MSForms.DataObject, _ ByVal X As Single, ByVal Y As Single, _ ByVal DragState As MSForms.fmDragState, _ ByVal Effect As MSForms.ReturnEffect, _ ByVal Shift As Integer) Cancel = True End Sub Private Sub TextBox2_BeforeDropOrPaste( _ ByVal Cancel As MSForms.ReturnBoolean, _ ByVal Action As MSForms.fmAction, _ ByVal Data As MSForms.DataObject, _ ByVal X As Single, ByVal Y As Single, _ ByVal Effect As MSForms.ReturnEffect, _ ByVal Shift As Integer) TextBox2.Text = msText End Sub Regards, Peter T "Roger on Excel" wrote in message ... I am using userforms alot for data entry. Is there a way to allow one to drag and drop text from one text box / combo box to another? This would be especially useful since it would allow me to move entered data down or up within the userform during editing. However i cannot drag text from one box to another (as one can in say word or in the sheet itself). Can anyone help? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Combo boxes in userform auto drop down problem | Excel Programming | |||
Make text cells and combo boxes required? | Excel Discussion (Misc queries) | |||
how do I drag & drop cell text only | New Users to Excel | |||
filling text boxes from a combo box | Excel Programming |