Consulting

Results 1 to 6 of 6

Thread: Drag and Drop Files from Explorer

  1. #1

    Question Drag and Drop Files from Explorer

    I am creating a VBA userform that loads files into a listbox. What I want to do is give the user the ability to drag and drop files from windows explorer. Is this possible to do in VBA? Any help on this would be greatly appreciated.

    Thanks
    Murray Johnson
    Edmonton Catholic Schools

  2. #2
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    1. Please state what application and version you are doing this in.

    2. If I understand correctly, what you are asking for is the ability to have a UserForm lose its focus so someone can give Windows Explorer the focus, select files in Explorer, drag them back to the UserForm, give focus back to the UserForm, extract the variable contents of what is being dragged (that is, the string names) and put those string names into the listbox.

    Correct?

  3. #3
    1. It is in AutoCAD 2006

    2. Yes, that is what I want to do.

    Am I completely off base in thinking plain VBA can do this?

  4. #4
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    Hi johnsonm,

    Welcome to VBAexpress!

    To my knowledge VBA does not support Drag and Drop.

    As an alternative how about using the OpenFileNmae found here http://msdn.microsoft.com/library/d...penfilename.asp with a discussion here http://www.vbaexpress.com/forum/showthread.php?t=3518. Fill the listbox using this maybe? The only problem I see is having drawings/dxf/dwt's from different directories, but that can be fixed with the full path to the file (of course I am assuming that you want a list of drawings).

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master xld's Avatar
    Joined
    Apr 2005
    Posts
    25,082
    Location
    Stephen Bullen has a DragDrop.exe on his site at http://www.oaltd.co.uk/Excel/SBXLPage.asp. I haven't tried it personally, but you might want to check it out.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Nice example Bob! I always loved Steven's site...
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

Posting Permissions

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