How to solve runtime error 5 in vba?

How to solve runtime error 5 in vba?

Anonymous
Not applicable
1,029 Views
1 Reply
Message 1 of 2

How to solve runtime error 5 in vba?

Anonymous
Not applicable
I have two loops using Dir$ in vba. If exit the inside loop after an empty string is returned, then make another call to Dir$ with no arguments, the runtime error 5 occurs. Dose anybody know how to solve it?

Thanks,
0 Likes
1,030 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
LLily wrote: > I have two loops using Dir$ in vba. If exit the inside loop after an empty string is returned, then make another call to Dir$ with no arguments, the runtime error 5 occurs. Dose anybody know how to solve it? You might consider using the FileSystemObject in the Microsoft Scripting libary. It's already installed on your tartget machines and is much more object oriented as well as user friendly. Folder objects support subfolder and file collections making it much easier to loop through the contents of any given folder. -- There are 10 kinds of people: those who understand binary and those who don't.
0 Likes