LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Counting backwards through the File System Object files collection

Here's the deal.

I'm attempting to move backwards through the fso files collection but
getting an "invalid procedure call" error. Here's the code I'm
struggling with:

Dim objFso As FileSystemObject
Dim objFolder As Folder
Dim objFile As File
Dim z As Long
Set dTPlusOneFiles = New Dictionary

'Count backwards through the files collection to get the four most
recently created files
For z = objFolder.Files.Count To 1 Step -1
Set objFile = objFolder.Files(z)
dTPlusOneFiles.Add objFile.Name, objFile.DateCreated
Next z

Strangely the error message occurs at this point: "Set objFile =
objFolder.Files(z)"

Any assistance will be gratefully appreciated.

Rob
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA and File System Object [email protected] Excel Programming 3 September 7th 06 06:21 PM
File System Object Jason Zischke Excel Programming 3 August 30th 06 07:52 AM
How do I close a file system object? Steph Excel Programming 2 March 8th 06 04:09 AM
File System Object Neil Excel Programming 2 September 10th 03 05:01 PM


All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"