Consulting

Results 1 to 2 of 2

Thread: extracting text from text box

  1. #1
    VBAX Newbie
    Joined
    Oct 2021
    Posts
    5
    Location

    extracting text from text box

    ...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

  2. #2
    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 Sub
    The problem however is that the text box will have been used to format the document in a particular way, which will be lost.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •