I have a document that has a number of rectangle shapes. I want to replace each of those with a TextBox in exactly the same place. My starting point is working with an existing known shape I want to replace with a textbox (later I'll add further automation to process the selected shape or all shapes).
This is my code so far:
Sub Macro3()
'
' Macro3 Macro
'
'
Dim shp As Shape
Dim Box As Shape
For Each shp In ActiveDocument.Shapes.Range(Array("Group 1928"))
shp.Select
Set Box = ActiveDocument.Shapes.AddTextbox( _
Orientation:=msoTextOrientationHorizontal, _
Left:=shp.Left, Top:=shp.Top, Width:=shp.Width, Height:=shp.Height)
Box.RelativeHorizontalPosition = shp.RelativeHorizontalPosition
Box.RelativeVerticalPosition = shp.RelativeVerticalPosition
Box.TextFrame.TextRange.Text = "Some text"
Next shp
End Sub
I've tried setting a number of other properties but the textbox always appears and stays at the top centre of the document page.
Thank you for any guidance you can offer.
Regards Tim