One thing I noticed in your code that I wouldn't do myself is this:
For n& = 0 To UBound(vText) - maxLines
vText(n&) = "~"
Next 'n
vText = Filter(vText, "~", False)
WriteTextFileContents Join(vText, vbCrLf), sFile
ISTM that going through the array, changing everything except what
you need,
is a waste of CPU cycles (especially with strings). Instead, I
would've just
pulled out the elements I actually needed and ignored the rest:
<1
I have never found writing a text file one line at a time to be very
efficient at best. I realize this depends on the number of lines in the
file, but since this will always be unknown at design time I'd opt for
using more a efficient approach.
<2
The point of replacing the elements to be removed by the Filter()
function is because it needs that to work for using a common 'Find'
string in all elements to be filtered.
<3
The way I did this requires way less code and is highly efficient
regardless of file length. (IMO)
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion