+ Reply to Thread
Results 1 to 3 of 3

Delete specific text boxes in workbook - blank text boxes/those with certain words

  1. #1
    Registered User
    Join Date
    02-18-2010
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    2

    Delete specific text boxes in workbook - blank text boxes/those with certain words

    Hi

    I needs a VBA code to delete all text boxes in a workbook that are blank and all text boxes that have a certain word in them (Hesketh).

    I have a lot of unrequired text boxes hidden somewhere in the workbook and have tried to find and delete them by using Go To - Special - Objects and that has found some of them for me to delete but not all. I found a VBA code in another post which would delete all text boxes but there are lots I want to keep. I have also found a code which says it would delete blank text boxes but it didn't work (had a problem with the second line compile error - User-defined type not defined).

    Sub DeleteEmptyTextBoxes()
    Dim oSld As Slide
    Dim oShp As Shape
    Dim I As Integer
    On Error Resume Next
    For Each oSld In ActivePresentation.Slides
    For I = oSld.Shapes.Count To 1 Step -1
    Set oShp = oSld.Shapes(I)
    If oShp.Type = msoTextBox Or oShp.Type = msoAutoShape Then
    If oShp.Fill.Visible = False And _
    oShp.Line.Visible = False And _
    (Not oShp.TextFrame.HasText) Then
    oShp.Delete
    End If
    End If
    Set oShp = Nothing
    Next I
    Next oSld
    End Sub

    Any help on this would be great.

    Michele

  2. #2
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394

    Re: Delete specific text boxes in workbook - blank text boxes/those with certain word

    Is this an Excel Question or a Powerpoint Question? The code looks like powerpoint

  3. #3
    Registered User
    Join Date
    02-18-2010
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Delete specific text boxes in workbook - blank text boxes/those with certain word

    Well that would certainly explain why the code didn't work. I need a code to delete the text boxes in excel.

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1