Jimekus
5/27/2012 1:37:00 AM
Saucer Man wrote:
> I have a rich textbox loaded with a 90mb file. I am trying to replace
> vbCrLf and vbTab. I am doing...
>
> tbox.txt = Replace(tbox.txt, vbCrLf, vbNull)
> tbox.txt = Replace(tbox.txt, vbTab, vbNull)
>
> Each line takes an extremely long time. Is there a better way of doing
> this?
>
> --
> Thanks.
My cut routine is very fast. Not tried on 90Mb files but on smaller
files always works well. Replace "vbNullstring" with a replace text
and maybe modify ".Find" position. Your slowness comes from converting
the richtext to a string each time.
'\\ cut all
StartPos = .DocText.SelStart
CutWhat = .DocText.SelText
LRWhat = Len(CutWhat)
c = StartPos
.DocText.Visible = False
While c >= Zero
.DocText.SelStart = c
.DocText.SelLength = LRWhat
.DocText.SelText = vbNullString
c = .DocText.Find(CutWhat, c + One, ,
rtfNoHighlight)
Wend
.DocText.SelStart = StartPos
.DocText.Visible = True