Code: Select all
Sub RemoveFrames()
Dim intC As Integer
For intC = ActiveDocument.Frames.Count To 1 Step -1
ActiveDocument.Frames(intC).Delete
Next intC
End Sub
Code: Select all
Sub RemoveFrames()
Dim intC As Integer
For intC = ActiveDocument.Frames.Count To 1 Step -1
ActiveDocument.Frames(intC).Delete
Next intC
End Sub
Code: Select all
Dim i As Integer
For i = ActiveDocument.Shapes.Count To 1 Step -1
If ActiveDocument.Shapes(i).Type = msoTextBox Then
ActiveDocument.Shapes(i).ConvertToFrame
End If
Next i
Goshute wrote:...couldn't figure out how to get to textboxes in the Word object model to automate that process. Can someone provide some pointers?
Code: Select all
Sub AllTextBoxes()
Dim shp As Shape
For Each shp In ActiveDocument.Shapes
If blnShapeSupportsAttachedText(shp) Then
' do something to the shape here
' MsgBox shp.Name
End If
Next shp
End Sub
Function blnShapeSupportsAttachedText(shpIn As Shape) As Boolean
blnShapeSupportsAttachedText = False
On Error GoTo Done
If shpIn.TextFrame.HasText Then blnShapeSupportsAttachedText = True
Done:
End Function
Perfect, thank you. (I got to the understanding they were shapes but got stuck when I couldn't see how to identify just the textboxe shape.)HansV wrote:Text boxes are shapes.
If ActiveDocument.Shapes(i).Type = msoTextBox Then
Thanks, Stuart. Always more than one way to skin the cat.StuartR wrote:shpIn.TextFrame.HasText
The two things are somewhat different. Hans approach will get to all text frames, which is what you asked for, mine will get to all text in any kind of shape, for example if you add a rectangle with no borders and no fill and put text in it then this is NOT a text frame.Goshute wrote:Thanks, Stuart. Always more than one way to skin the cat.StuartR wrote:shpIn.TextFrame.HasText