ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Scripting.FileSystemObject (https://www.excelbanter.com/excel-programming/390175-scripting-filesystemobject.html)

Ronald Dodge[_2_]

Scripting.FileSystemObject
 
Okay, I have tried using the item part of a folder collection object and a
file collection object.

I have tried it initially as late binding, then as early binding, neither
method helped.

I have tried it with using <object.Item(#) and I have also tried
<object(#) for both binding methods.

All 4 ways, I get the error message within the watch window, "Invalid
procedure call or argument".

I know I can use the For Each, which I have used that numerous times under
the late binding method, but I have come to a situation that I don't want
the program spending too much time searching and a pretty good majority of
the time given the nature of business practice, the code will find the
proper folder near the bottom of the folder list, so I was thinking of
having it search in reverse order via the For I = Last To First Step -1
route, but it seems as though it's not allowed. Am I missing something
here?

Where the # is, I would have that as a valid number and even used a number
like 2 for test purposes, when there's 5 items in the list as shown in the
watch window. In practice, there could really be more like about 200
folders in the parent folder.

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000



Tom Ogilvy

Scripting.FileSystemObject
 
The argument to ITEM for the folders collection is Key.

Debug.Print fldrs.Item("I386").Name

works returning I386. I don't believe it accepts an index argument - only
the key value; which for folders appears to be the folder name.

--
Regards
Tom Ogilvy

"Ronald Dodge" wrote in message
...
Okay, I have tried using the item part of a folder collection object and a
file collection object.

I have tried it initially as late binding, then as early binding, neither
method helped.

I have tried it with using <object.Item(#) and I have also tried
<object(#) for both binding methods.

All 4 ways, I get the error message within the watch window, "Invalid
procedure call or argument".

I know I can use the For Each, which I have used that numerous times under
the late binding method, but I have come to a situation that I don't want
the program spending too much time searching and a pretty good majority of
the time given the nature of business practice, the code will find the
proper folder near the bottom of the folder list, so I was thinking of
having it search in reverse order via the For I = Last To First Step -1
route, but it seems as though it's not allowed. Am I missing something
here?

Where the # is, I would have that as a valid number and even used a number
like 2 for test purposes, when there's 5 items in the list as shown in the
watch window. In practice, there could really be more like about 200
folders in the parent folder.

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000





urkec

Scripting.FileSystemObject
 

"Ronald Dodge" wrote:


I know I can use the For Each, which I have used that numerous times under
the late binding method, but I have come to a situation that I don't want
the program spending too much time searching and a pretty good majority of
the time given the nature of business practice, the code will find the
proper folder near the bottom of the folder list, so I was thinking of
having it search in reverse order via the For I = Last To First Step -1
route, but it seems as though it's not allowed. Am I missing something
here?

Where the # is, I would have that as a valid number and even used a number
like 2 for test purposes, when there's 5 items in the list as shown in the
watch window. In practice, there could really be more like about 200
folders in the parent folder.


What kind of search?

--
urkec




All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com