Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Drag and drop text in userform text / combo boxes

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Drag and drop text in userform text / combo boxes

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
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
Combo boxes in userform auto drop down problem [email protected] Excel Programming 3 March 13th 08 02:43 PM
Make text cells and combo boxes required? mlroy@savvis Excel Discussion (Misc queries) 2 July 24th 06 08:19 PM
how do I drag & drop cell text only Kirstie New Users to Excel 2 May 11th 06 03:01 AM
filling text boxes from a combo box JT[_2_] Excel Programming 1 February 21st 05 04:03 PM


All times are GMT +1. The time now is 01:29 AM.

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

About Us

"It's about Microsoft Excel"