Thread: DIR command (VB6 and Word97 VBA)
2003-07-01, 16:04 #1JustCallMeAlGuest
DIR command (VB6 and Word97 VBA)
I have been having some wierd happenings with the DIR command. Simply put, it will not show all the files meeting the criteria.
Specifically, I have 300 *.doc files in a directory (this happens in both network drives and local drives). When I run the following code, it only prints out 199 of them. Suggestions?
<pre>Public Sub thisisit()
Dim MyPath As String
Dim MyName As String
MyPath = "C:COJKMainTesting*.doc" ' Set the path.
MyName = Dir(MyPath, vbDirectory Or vbHidden Or vbArchive Or vbReadOnly _
Or vbSystem) ' Retrieve the first entry.
Do While MyName <> ""
MyName = Dir
Subscribe to our Windows Secrets Newsletter - It's Free!
Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!
+ Get this BONUS — free!
Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!
2003-07-01, 16:59 #2
- Join Date
- Feb 2001
- Dublin, Ireland, Republic of
- Thanked 0 Times in 0 Posts
Re: DIR command (VB6 and Word97 VBA)
It probably has more to do with the number of lines you can print to the immediate window, than any problem with your code.
I think the maximum number lines is around 200.