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

Here you go Peter!

Attached is a workbook with the code to accomplish what you want. Jus
run the "BrowseFolder" macro and you will be presented with a Window
Explorer window which will allow you to select a directory of you
choice. Once selected, click OK and the path to the directory you jus
selected will be placed in the text box on the included form. The inf
from this text box will then be used with a loop to populate a listbo
on the same form with each of the filenames found within that specifi
directory. After selecting one of the files from the list box an
clicking the submit button, you will write the directory path, th
selected filename, and the full file path to cells in columns A, B, an
C of the worksheet. Just step through the code and make whateve
changes you 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. The original version of this project could only be use
to obtaining the directory path but I modified the code so that i
would also list each individual files within a specific directory. Th
code was also modified by me so that it would work with Excel VBA.
have been using this code with several Excel macros I have written an
it works great!! The macro will crash if you run the applicatio
straight from the provided link below so make sure to right click th
link and save the workbook before running it. Good luck, I hope thi
helps! :)



Rolli

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