EKet
EKet

Reputation: 7314

Excel VBA: How to Read file names of type PDF and spit them into a column on a sheet

In Excel 2003 is there any way to read pdf file names from a single directory and put them inside an Excel spreadsheet?

Upvotes: 0

Views: 4718

Answers (2)

Tim Williams
Tim Williams

Reputation: 166306

Dim c as Range, tmp  
Dim FolderPath as string

FolderPath = "C:\MyFolder\" 
Set c = ActiveSheet.Range("A1")

tmp = Dir(FolderPath & "*.pdf")
Do While tmp<>""
  c.value = tmp
  set c = c.offset(1,0)  
  tmp=Dir()
Loop

Tim

Upvotes: 1

Tiago Cardoso
Tiago Cardoso

Reputation: 2097

To list files from a folder take a look at FileSystemObject.

Provide os more info about what you need, we'll help you better.

Rgds

Upvotes: 0

Related Questions