View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Determine sheets in file

Dim rng as Range, cell as Range, sh as Worksheet
Dim j as Long
set rng = Range(cells(1,1),Cells(1,1).End(xldown))
for each cell in rng
set bk = Workbooks.Open(cell.Value)
j = 2
for each sh in bk.Worksheets
cells(cell.row,j).Value = sh.name
j = j + 1
Next
bk.close SaveChanges:=False
Next

--
Regards,
Tom Ogilvy



"Steph" wrote in message
...
If I had a list of files (full file path), how could I loop through them

and
capture all the sheet names within each file.

For example, file names in column A, sheet names in B forward.

Thank you!