[VBA] Drag&Drop target in Userform

skorpionkz

Well-known Member
Joined
Oct 1, 2013
Messages
1,168
Hi All,

I am developing new functionality to the VBA application I have and I want to try to use Drag&Drop functionality.
For simplicity, I have 2 user forms. First contains ListView (MSComctlLib.ListView) with items for user to select. I am trying to use myListView_OLEDragDrop to drag data from this list to another user form TextBox and/or ComboBox.
Problem for me is that the text and combo boxes are dynamically created by VBA and I can't find the way to identify "target" field, where I am dropping value.

Any idea?

Thank you,
Andrzej
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,069
Office Version
  1. 2016
Platform
  1. Windows
You could use the WithEevnts keyword to hook the BeforeDragOver and BeforeDropOrPaste events of the dynamically created textbox and combobox .
 

skorpionkz

Well-known Member
Joined
Oct 1, 2013
Messages
1,168
You could use the WithEevnts keyword to hook the BeforeDragOver and BeforeDropOrPaste events of the dynamically created textbox and combobox .
I was looking at it, but I couldn't find any way to identify target field (I mean where I am dropping value) :( I probably missing something obvious.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,656
Messages
5,573,432
Members
412,529
Latest member
cTatch
Top