Fin Fang Foom
Well-known Member
- Joined
- Mar 20, 2005
- Messages
- 598
Hi,
I have a Word document that has alot of frames. I got this code below that will convert the Frame to TexBox. BUT it will just do one Frame.
How to modify the code that it will loop through the whole document and covert ALL frames to TexBox.
https://social.msdn.microsoft.com/F.../vba-to-convert-frame-to-textbox?forum=isvvba
Sub Convert_Frame_to_TextBox()
Dim frame As Word.frame
Set frame = ActiveDocument.Frames(1)
Dim CopyRange As Word.Range
Set CopyRange = frame.Range.Duplicate
With frame.Range
.Select
.Cut
.Select
End With
Dim CursorX, CursorY, FrameWidth, FrameHeight
CursorX = Selection.Information(wdHorizontalPositionRelativeToPage)
CursorY = Selection.Information(wdVerticalPositionRelativeToPage)
FrameWidth = ActiveDocument.Frames(1).Width
FrameHeight = ActiveDocument.Frames(1).Height
Dim txtbox As Word.Shape
Set txtbox = ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, CursorX, CursorY, FrameWidth, FrameHeight)
txtbox.Select
Selection.Range.Paste
txtbox.Select
Selection.Cut
frame.Select
Selection.Delete
Selection.Paste
End Sub
I have a Word document that has alot of frames. I got this code below that will convert the Frame to TexBox. BUT it will just do one Frame.
How to modify the code that it will loop through the whole document and covert ALL frames to TexBox.
https://social.msdn.microsoft.com/F.../vba-to-convert-frame-to-textbox?forum=isvvba
Sub Convert_Frame_to_TextBox()
Dim frame As Word.frame
Set frame = ActiveDocument.Frames(1)
Dim CopyRange As Word.Range
Set CopyRange = frame.Range.Duplicate
With frame.Range
.Select
.Cut
.Select
End With
Dim CursorX, CursorY, FrameWidth, FrameHeight
CursorX = Selection.Information(wdHorizontalPositionRelativeToPage)
CursorY = Selection.Information(wdVerticalPositionRelativeToPage)
FrameWidth = ActiveDocument.Frames(1).Width
FrameHeight = ActiveDocument.Frames(1).Height
Dim txtbox As Word.Shape
Set txtbox = ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, CursorX, CursorY, FrameWidth, FrameHeight)
txtbox.Select
Selection.Range.Paste
txtbox.Select
Selection.Cut
frame.Select
Selection.Delete
Selection.Paste
End Sub