Results 1 to 2 of 2

Drag and Drop data using Treeview -Working great for the first drop, but locking on 2nd

Threaded View

  1. #1
    Registered User
    Join Date
    07-16-2015
    Location
    Brighton, England
    MS-Off Ver
    2010
    Posts
    71

    Drag and Drop data using Treeview -Working great for the first drop, but locking on 2nd

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Index/Sum Formula -Drap Drop Column, Help with Drag Drop Row
    By bbis21 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-17-2015, 09:36 PM
  2. Drag&drop outlook email to drop zone in excel
    By mpx300 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-02-2015, 05:00 PM
  3. Replies: 2
    Last Post: 04-07-2015, 04:01 PM
  4. How to keep Data Validation list after a drag and drop...
    By pasqualebaldi in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-09-2015, 03:31 PM
  5. Data Validation, drag and drop, auto population questions
    By Phouthavongc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2013, 10:08 AM
  6. VBA treeview drag and drop
    By smehnert in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-22-2013, 09:24 AM
  7. Treeview Control Drag and Drop
    By MikeBrough in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-10-2007, 10:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1