View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Rollin_Again[_10_] Rollin_Again[_10_] is offline
external usenet poster
 
Posts: 1
Default Using a "File-Open"-Window in a Excel Macro?

Here ya go Peter!

Attached is a workbook with the code to accomplish what you want. Jus
run the "BrowseForFolder" macro and you will be presented with
Windows Explorer window which will allow you to select a directory o
your choice. Once selected, click OK and the path to the director
will be placed in both a text box in the included form as well as i
the next available cell in column A of the workbook. After obtainin
the directory path of your choice, the code will loop through th
directory and add each of the individual filenames to a listbox on th
same form. Just step through the code and make whatever changes yo
need.

The original code which I obtained from a former co-worker was found o
the internet and was originally developed as a stand-alone VB
application used for obtaining paths of only root directories.
modified the code so that it would also list each individual file
within a specific directory and also modified it so that it would wor
with Excel VBA. I have been using this code with several Excel macro
I have written and it works great!!

I hope you find it as useful as me!

Rolli

Attachment filename: browse for folder.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=52090
--
Message posted from http://www.ExcelForum.com