Consider the following table in Word 2013
A BBB
A CCC
D E F
A, B and C are merged cells.
A and B are empty. C has text A
inside.
Now the following code
Set rng = ActiveDocument.Range(0, 0)
With rng.Find
.Forward = True
.Wrap = wdFindStop
.Execute "A"
End With
Crashes word on Execute "A"
.
If I change text to Execute "B"
it doesn't find anything but doesn't crash word. Issue is present only in word 2013.
We tried searching manually and Selection.Find
cell by cell, but both of those are rather slow.
Is there a quick way to circumvent this error?
EDIT: this is minimum fail example that I constructed. In our application we use a lot of Range.Find
, sometimes with wrap and almost never starting from Document.Start
EDIT2: further investigation shows that Error isn't present if you open Document in compatibility mode (Word 97-2003 format).
And you can't just activate a .Find
object off the Tables(index).Selection
object rather than the range object?
If you are just activating the .Selection object off of the ActiveDocument instead of the Table object then, yeah that could take forever. But coming directly off the table index will speed it up significantly.
ActiveDocument.Tables(1).Select
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.Execute FindText:="A"
End With
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With