Get list of files in a folder in Excel

K

Khoshravan

I am not sure if this newsgroup is the right place to ask this question. If
it is not, please guide me to a proper one.

I have a series of paper (in pdf format) inside a folder.
I would like to prepare a directory of these papers in an Excel (or Access)
file and add some data, like title of paper (obtained from inside the file)
number of page, file size (Kb).
Now I do it manually by pressing (F2 key), getting the file name, copy/paste
into excel and checking the page number visually and again copy/paste which
is very time consuming.


Is there any share/freeware to do this job for me? Is there any easy Macro
to write in Windows to do this job?
Any help/suggestion is appreciated.
 
J

Joel

If you want to do it in excel this works. Change Mydir to match your
directory. macro gets filename and filesize and put them in column a and b.

Sub pdfsize()

Dim FileSize As Long
Mydir = "c:\temp"

RowCount = 1
First = True
Do While (1)

If First = True Then
MyFilename = Dir(Mydir + "\*.pdf")
First = False
Else
MyFilename = Dir
End If

If MyFilename = "" Then Exit Do

Cells(RowCount, "A") = MyFilename
FileSize = FileLen(Mydir + "\" + MyFilename)
Cells(RowCount, "B") = FileSize
RowCount = RowCount + 1
Loop

End Sub
 

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