Macro to print files in a folder

R

Ricki Miles

I am using Word 2003. I know there is a macro to print the filenames of a
particular folder. Can anyone please direct me to it? TIA,

Ricki
 
M

Martin Seelhofer

Hi Ricki
I am using Word 2003. I know there is a macro to print the filenames of a
particular folder. Can anyone please direct me to it? TIA,

Here's a starting point (working in all Office apps):

Sub enumFiles(folder As String)
Dim file As String
file = Dir(folder & "\*")
Do Until file = ""
Debug.Print file
file = Dir()
Loop
End Sub

Usage:

enumFiles "D:\temp"
or:
Call enumFiles("D:\temp")


Cheers,
Martin
 
R

Ricki Miles

Thanks, Martin,

I was hoping for a message box to type in the pathname so the macro could be
generic. I'm don't know how to do that and would appreciate your help.
Thanks,

Ricki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top