PDA

View Full Version : extracting text from text box



crazy1
10-24-2021, 01:27 AM
...and deleting the text box

is there a simple way without difficult procedure codes ? MY VBA version is 7.1
This is one of my questions on my previous post in reformatting pages on adding page numbers. :)
tanks in advance once again

gmayor
10-24-2021, 04:04 AM
Maybe something like the following will work with a selected floating text box
Sub Macro1()
Dim sText As String
Dim oRng As Range
Set oRng = Selection.ShapeRange.TextFrame.TextRange
sText = oRng.Text
Set oRng = Selection.ShapeRange.ConvertToInlineShape.Range
oRng.Text = sText
Set oRng = Nothing
End SubThe problem however is that the text box will have been used to format the document in a particular way, which will be lost.