K
keith
Hello,
I am using VBA to edit documents with a complex page and
line numbering system. The VBA is very effective, but
I've encountered a problem with a large document. Here is
the situation.
The source document comes from a mainframe system. Each
line of the source document text begins with an indicator
of page and line. For example.
15 3 text text text
15 4 more text more text
I can remove the numbers using a for/next loop that
identifies each possible combination of page and line
number and then changes the combination to some other
value. With the assistance of the macro builder plus
my enhancements, I created the following code.
For I = 1 to MaxPages
' code here creates string1
' in much the same way that
' String2 is created below
For j = 1 To MaxLinesPerPage
If j < 10 Then
String2 = Format(Str(j), " 0")
Else
String2 = Format(Str(j), " 00")
End If
String0 = String1 & String2
myrange.Find.Execute FindText:=String0, _
ReplaceWith:=String3, _
Replace:=wdReplaceAll
And so on.
The code works great. However, with a large document
there can be over 1,000 lines and over 1,000 calls to this
findtext method. With that many calls, the Word "can't
undo" warning pops up. In a test document I've had to
click the "can't undo" dialog box over 100 times before it
goes away. I also receive a warning that there have been
too many edits on the document. Searching help, I do not
fnd a way to either turn-off off or respond to either
warning.
How can I either turn off or programmatically answer "ok"
to all those "can't undo" and "too many edits" warnings?
Thank you
Keith
I am using VBA to edit documents with a complex page and
line numbering system. The VBA is very effective, but
I've encountered a problem with a large document. Here is
the situation.
The source document comes from a mainframe system. Each
line of the source document text begins with an indicator
of page and line. For example.
15 3 text text text
15 4 more text more text
I can remove the numbers using a for/next loop that
identifies each possible combination of page and line
number and then changes the combination to some other
value. With the assistance of the macro builder plus
my enhancements, I created the following code.
For I = 1 to MaxPages
' code here creates string1
' in much the same way that
' String2 is created below
For j = 1 To MaxLinesPerPage
If j < 10 Then
String2 = Format(Str(j), " 0")
Else
String2 = Format(Str(j), " 00")
End If
String0 = String1 & String2
myrange.Find.Execute FindText:=String0, _
ReplaceWith:=String3, _
Replace:=wdReplaceAll
And so on.
The code works great. However, with a large document
there can be over 1,000 lines and over 1,000 calls to this
findtext method. With that many calls, the Word "can't
undo" warning pops up. In a test document I've had to
click the "can't undo" dialog box over 100 times before it
goes away. I also receive a warning that there have been
too many edits on the document. Searching help, I do not
fnd a way to either turn-off off or respond to either
warning.
How can I either turn off or programmatically answer "ok"
to all those "can't undo" and "too many edits" warnings?
Thank you
Keith