开发者

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

开发者 https://www.devze.com 2023-02-21 02:36 出处:网络
In Excel 2003 is there any way to read pdf file names from a single director开发者_开发问答y and put them inside an Excel spreadsheet?Dim c as Range, tmp

In Excel 2003 is there any way to read pdf file names from a single director开发者_开发问答y and put them inside an Excel spreadsheet?


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消