Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2007
    Location
    Gray, Louisiana, USA
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Does anyone have a Macro that will select a text box and clear the contents?

  2. #2
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    I assume you mean a Text Box Object placed on a worksheet.

    These are members of the shapes collection

    So If Your Text Box is called Text Box 1 then

    Code:
    ActiveSheet.Shapes("Text Box 1").TextFrame.Characters.Delete
    You can also do it by Number, BUT you need to know which of the shapes
    on the sheet it is So IF it was shape 2


    Code:
    ActiveSheet.Shapes(2).TextFrame.Characters.Delete
    You can also Clear it from a specific sheet


    Code:
    Sheets("What Ever The Sheet Is").Shapes("Text Box 1").TextFrame.Characters.Delete
    etc

    BUT TRYING to find this information in the VBA help is pretty impossible.
    Well NOT impossible, but hidden inside the Object Browser.


    Andrew

  3. #3
    2 Star Lounger
    Join Date
    Jan 2007
    Location
    Gray, Louisiana, USA
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ActiveSheet.Shapes(2).TextFrame.Characters.Delete

    The above line did the trick for me, as far as I can tell it works great.

    Thank you very much!

Posting Permissions

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