[quoted text clipped - 21 lines]
As a follow up to this thread, Jean-Guy was kind enough to let me email
him an abstract of the problem document. It appears, the problem was,
textboxes in it were grouped, which prevented the macro from working.
Jean-Guy emailed me a macro which does the trick of ungrouping these
grouped boxes, saving the text and removing the boxes. This macro will
of course also work if the text boxes are not grouped.
The macro I am posting hereunder incorporates limited changes I made to
the one Jean-Guy emailed me, so if you find any problem with it, I am to
blame and not Jean-Guy.
Regards
__________________________________________
Option Explicit
Sub test()
Dim rngText As Range
Dim shpText As Shape
Dim i As Long
Dim j As Long
'To speed things up a bit, especially if you lots of textboxes.
Application.ScreenUpdating = False
With ActiveDocument
For i = .Shapes.Count To 1 Step -1
If .Shapes(i).Type = msoGroup Then
j = .Shapes(i).GroupItems.Count
.Shapes(i).Ungroup
'As we ungroup, the number of shapes increases, we have to
adjust
'Also, there might be groups within groups...
i = i + (j - 1)
End If
Next
For Each shpText In .Shapes
With shpText
If .Type = msoTextBox Then
If .TextFrame.HasText Then
Set rngText = .Anchor.Paragraphs(1).Range
With rngText
.Collapse Direction:=wdCollapseEnd
.FormattedText = shpText.TextFrame _
.TextRange.FormattedText
End With
shpText.Delete
End If
End If
End With
Next
End With
Application.ScreenRefresh
Application.ScreenUpdating = True
End Sub
_________________________________________