T
Tony Logan
I'm using a macro to find all text boxes in a document. A behavior I've
witnessed that I can't explain is that rather than finding each text box
sequentially, the order in which the macro finds each text box appears
random. For instance, the macro never processes text box #1, then #2, then #3
and so on. Instead, the order is always something like: 15, 2, 3, 4, 11, 31,
and so on.
Just wondering if anyone has an explanation for why this would happen.
The code below is the portion of the macro that's supposed to find the text
boxes:
For Each myShp In ActiveDocument.Shapes
If myShp.Type = msoTextBox Then
i = i + 1
With myShp
myShp.Select
End With
myShp.ConvertToFrame
End If
Next
witnessed that I can't explain is that rather than finding each text box
sequentially, the order in which the macro finds each text box appears
random. For instance, the macro never processes text box #1, then #2, then #3
and so on. Instead, the order is always something like: 15, 2, 3, 4, 11, 31,
and so on.
Just wondering if anyone has an explanation for why this would happen.
The code below is the portion of the macro that's supposed to find the text
boxes:
For Each myShp In ActiveDocument.Shapes
If myShp.Type = msoTextBox Then
i = i + 1
With myShp
myShp.Select
End With
myShp.ConvertToFrame
End If
Next