Results 1 to 2 of 2

Thread: Selecting All Objects By Text Color [Powerpoint]

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    2

    Selecting All Objects By Text Color [Powerpoint]

    Hey, I'm trying to select all text boxes in a powerpoint file by the color of the text. Once selected, I would like to change the color of the text. Is it possible to enumerate all the text boxes in the file and then go through one by one? If so, what methods would I need to use? Thanks.

  2. #2
    Fanatic Member kaffenils's Avatar
    Join Date
    Apr 2004
    Location
    Norway
    Posts
    946

    Re: Selecting All Objects By Text Color [Powerpoint]

    This code enumerate all objects on all slides in the first presentation.
    It checks for text boxes with forn color 0 (black) and replaces the color with 255 (red). Just remember that a text box can have multiple text formats (colors, fonts, sizes etc), and this code will only check the first font format and if the color matches it will replace the font color of the entire text box.

    VB Code:
    1. Dim app As Application
    2. Dim sl As Slide
    3. Dim shp As Shape
    4.  
    5. Set app = Application
    6.  
    7. For Each sl In app.Presentations(1).Slides
    8.     For Each shp In sl.Shapes
    9.         If shp.Type = msoTextBox Then
    10.             If shp.TextFrame.TextRange.Font.Color.RGB = 0 Then
    11.                 shp.TextFrame.TextRange.Font.Color.RGB = 255
    12.             End If
    13.         End If
    14.     Next shp
    15. Next sl
    16.  
    17. Set shp = Nothing
    18. Set sl = Nothing
    19. set app=nothing

Posting Permissions

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



Click Here to Expand Forum to Full Width