Translation - Μετάφραση

Resources, Technical Assistance and Technology News => Translator resources => Tips on Using Computers => Topic started by: spiros on 09 Aug, 2021, 20:55:01

Title: Erase text boxes in Word but retain text and formatting (macro)
Post by: spiros on 09 Aug, 2021, 20:55:01
Erase text boxes in Word but retain text and formatting

Code: [Select]
Sub EraseTextBoxes()
Dim RngDoc As Range, RngShp As Range, i As Long
With ActiveDocument
  For i = .Shapes.Count To 1 Step -1
    With .Shapes(i)
      If .Type = msoTextBox Then
        Set RngShp = .TextFrame.TextRange
        RngShp.End = RngShp.End - 1
        Set RngDoc = .Anchor
        RngDoc.Collapse wdCollapseEnd
        RngDoc.FormattedText = RngShp.FormattedText
        .Delete
      End If
    End With
  Next
End With
End Sub

Removing text box from word document without removing the text inside - Microsoft Community (https://answers.microsoft.com/en-us/msoffice/forum/all/removing-text-box-from-word-document-without/a4d02b2f-d168-48dc-960b-4a45cbe79d86)
Removing All Text Boxes In a Document (Microsoft Word) (https://wordribbon.tips.net/T009169_Removing_All_Text_Boxes_In_a_Document.html)