Populate column with files from selected folder

  • I found this code on this forum a while ago.



    I tried to change it where you get the GetOpenFilename pop-up box and make a choice from it instead of entering the path in an input box. However, whatever I tried did not work. I get the pop-up box OK but all I get is that I did not select a file.



    Could someone show me where I went wrong.
    Thanks and regards
    John

  • Re: Populate column with files from selected folder


    perhaps this helps


    Code
    p = Application.GetOpenFilename
    MsgBox Left(p, InStrRev(p, "\") - 1): 'the path
    MsgBox Dir(Application.GetOpenFilename): 'the filename

    [COLOR="Purple"]Eternity is a terrible thought. I mean, where's it going to end??[/COLOR]

  • Re: Populate column with files from selected folder


    Thank you very much for the replies.
    The file from aadarsh works good. Would it be faster through a userform?
    The file from Maqbool does not do anything in Excel 2003 and in Excel 2000 it gives a compile error (User-defined type not defined) highlighting the "Dim fdlogue As FileDialog" part.
    I have not tried fengore's suggestion yet but I will as soon as I can.
    Thanks and regards
    John

  • Re: Populate column with files from selected folder


    Hi Aardarsh,


    Just found this thread whilst trying to do, well exactly what your code does, but in DOS!


    Im sure i will get to grips with most of what you have done but what are these all about?

    Code
    Public Const BIF_BROWSEFORCOMPUTER = &H1000
    Public Const BIF_BROWSEFORPRINTER = &H2000
    Public Const BIF_BROWSEINCLUDEFILES = &H4000

    etc..


    Cheers
    Neil

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!