Solved

Incorporate a folder picker in existing macro code

Posted on 2013-06-15
2
311 Views
Last Modified: 2013-06-17
Dear Experts:

below macro, courtesy of an EE expert, lists all the paths of all files of a given directory in Column A of the current worksheet.

I  wonder whether somebody could help me to incorporate a folder picker in this code.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas


Sub List_Path_Of_Files()
'List Files (entire path) from a given directory in Column A of current excel worksheet
'requires a folder picker to be perfect

Dim MyFolder As String
Dim MyFile As String
Dim a As Integer
MyFolder = "C:\Test\" ' <-- Change to your folder
MyFile = Dir(MyFolder & "*.*")
a = 0
Do While MyFile <> ""
    a = a + 1
    Cells(a, 1).Value = MyFolder & MyFile
    MyFile = Dir
Loop
MsgBox "Done. Column A lists all of the files of the given directory"
End Sub

Open in new window

0
Comment
Question by:AndreasHermle
2 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 39250649
Here you go.
EE.xlsm
0
 

Author Closing Comment

by:AndreasHermle
ID: 39252705
Hi Macro Shadow,

I am very impressed. Thank you very much for your swift and professional help. Regards, Andreas
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now