'---------------------------------------------------------------------------------------
' Procedure : Frames2TextBoxes
' Author : Alexey Egorov, [email protected]
' Date : 11-Jul-2010
' Purpose : Replaces all frames in active document with textboxes keeping position.
' Topic : http://www.experts-exchange.com/Microsoft/Applications/Q_26319089.html
'---------------------------------------------------------------------------------------
Sub Frames2TextBoxes()
Dim aF() As Word.Frame, f As Word.Frame, t As Word.Shape, i As Long, n As Long
Dim stbar As Boolean
On Error GoTo err_
Application.ScreenUpdating = False
stbar = Application.DisplayStatusBar
n = ActiveDocument.Frames.Count
ReDim aF(n)
For i = 1 To n
Set aF(i) = ActiveDocument.Frames(i)
Next
For i = 1 To n
Application.StatusBar = Format(i, """Converting ""####") & Format(n, """ of ""####")
Set f = aF(i)
f.Range.Select
Selection.CreateTextbox
Set t = Selection.ShapeRange(1)
t.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
t.RelativeVerticalPosition = wdRelativeVerticalPositionPage
t.Width = f.Width
t.Height = f.Height
t.Left = f.HorizontalPosition
t.Top = f.VerticalPosition
With t.TextFrame
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
End With
t.Line.Visible = msoFalse
Next
exit_here:
Application.ScreenUpdating = True
Application.DisplayStatusBar = stbar
Exit Sub
err_:
MsgBox Err.Description, vbCritical
Resume exit_here
End Sub
|