Hi thanks for looking!
I have custom userform running in the attached image.
I am creating a database like system to store files saving paperwaste & I am trying to introduce a drag and drop file to grab the path of this file, (which, to open, I will shell with ' explorer.exe & path' within another userform <-- this bits working)
On the first occasion of the drop, its grabbing the file path and directing it to a worksheet successfully. After this first drop has been actioned, it has a call to show an identical userform for another drag and drop -
Problem is, that's its locking up the file explorer until I break the code. I've tried a Sendkeys with Escape, turning the drop mode off but I no success.
Any ideas will be greatly appreciated! Another idea is implementing a non-modal attribute to this useroform, but I do not know how to do this
Thanks for your help code is below if you can assist!
Private Sub UserForm_Initialize()
TreeView1.OLEDropMode = ccOLEDropManual
End Sub
Private Sub TreeView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim Path As Variant
Dim Identifier As Variant
Dim IdentifierAddress As Variant
ActiveWorkbook.Worksheets("DATA").Activate
Identifier = Selection.Value
IdentifierAddress = Selection.Address
ActiveWorkbook.Worksheets("HOME").Activate
Path = Data.Files(1)
ActiveWorkbook.Worksheets("DATA").Activate
Range(IdentifierAddress).Offset(, 4).Value = Path
ActiveWorkbook.Worksheets("HOME").Activate
TreeView1.OLEDropMode = ccOLEDropNone
SendKeys "{ESCAPE}"
Unload Me
Path = ""
Application.Wait (Now() + TimeValue("00:00:01"))
With AddDataUserForm05
.Top = Application.Top * 0.5
.Left = Application.Left * 0.5
.Show
End With
End Sub
Bookmarks