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: 10
Default FileSystemObject Issues

I'm getting an "invalid procedure call or argument" every time I try
to take control of a collection of files that I've grabbed. With this
setup:

Dim wkbk1 As Workbook, wkbk2 As Workbook
Dim objFSO As FileSystemObject
Dim objFiles As Files

Set objFSO = New FileSystemObject
Set objFiles = objFSO.GetFolder(strFolder).Files 'strFolder is some
path
Set wkbk1 = Workbooks.Open(objFiles(1))
Set wkbk2 = Workbooks.Open(objFiles(2))

I get an error the moment objFiles(1) or objFiles.Item(1) is called. I
know there are two files in the proper folder. objFiles.Count returns
2.

For Each f in objFiles
Workbooks.Open(f)
Next

^ This properly opens both files as I thought my original call should
have. What am I doing wrong?

On a side note, what is the proper way to open up a number of files in
a specific directory and assign each of them to a variable, so that I
can mess with them all simultaneously? In this case, I just happened
to know there were only two files, and I thought this would be
easiest.

Thanks for the help.
 
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
FileSystemObject help please. DaveO Excel Programming 0 July 11th 05 08:33 AM
FileSystemObject help please. Tom Ogilvy Excel Programming 0 July 8th 05 04:44 PM
FileSystemObject help please. Bob Phillips[_7_] Excel Programming 0 July 8th 05 04:44 PM
Filesystemobject Help CyndyG Excel Programming 4 May 17th 05 01:00 AM
Help with FileSystemObject? Ed[_9_] Excel Programming 2 August 5th 03 12:08 AM


All times are GMT +1. The time now is 06:29 AM.

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"