View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Delete all, but the last 23 lines of an external text file

Uh.., couple of things worth mentioning here.<g

<1st
I'm not sure why you use the type symbol everywhere the var is used:

Since
Dim n&, fnum&

is the same as

Dim n As Long, fnum As Long

we wouldn't write...

For n As Long =...
or
vText(n As Long)
</1st

<2nd
I had occasion to strip trailing blank lines from 1000s of CNC program
files and I did same way using Filter(), only starting with UBound
using Step -1 until I got an element with Len(). CNC prog files are
never empty, but every time a controller writes back edited files the
default line feed was added. That's why my write sub prepends a vbCrLf
to the output string if AppendMode. I never thought to use Redim
Preserve as you do here. I'm definitely going to review that old code
now, after reading your approach!<g
</2nd

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion