-1

I need help! I´m an ESL English teacher. I´m doing my class planning in Power Point and I need to change all the Uppercases of each text box in all slides from black to red. I´m not a programmer, so I don´t know how to do this. Please, help me.

1 Answers1

1

Use this in a regular module in your project:

Option Explicit
Sub ColourCapitalLetters()

    Dim oSlide As Slide
    Dim oShapes As Shapes
    Dim oShape As Shape
    Dim I As Long
            
    For Each oSlide In ActivePresentation.Slides
        Set oShapes = oSlide.Shapes
        For Each oShape In oShapes
            If oShape.HasTextFrame Then
                If oShape.TextFrame.HasText Then
                    Debug.Print oShape.TextFrame.TextRange.Text
                    For I = 1 To Len(oShape.TextFrame.TextRange.Text)
                        If LCase(Mid(oShape.TextFrame.TextRange.Text, I, 1)) <> Mid(oShape.TextFrame.TextRange.Text, I, 1) Then
                            oShape.TextFrame.TextRange.Characters(I, 1).Font.Color.RGB = RGB(255, 0, 0)
                        End If
                    Next I
                End If
            End If
        Next oShape
    Next oSlide
                
End Sub

example
VBA Module

Cameron Critchlow
  • 1,814
  • 1
  • 4
  • 14
  • That turns all upper characters into red.... I believe OP wants completely upper case entire words. – pgSystemTester Aug 12 '22 at 00:11
  • Hm... It's hard to tell with the question, I still think the question indicated all uppercase characters... Easy enough though, after you find a capital, loop ahead until you find a space or punctuation. – Cameron Critchlow Aug 12 '22 at 00:13
  • Ah good point... easiest fix would be to `<> lower()` Will fix – Cameron Critchlow Aug 12 '22 at 00:16
  • 1
    cameron You may be correct on the question, rereading it again, it isn't clear. I guess I assumed for the hardest... @Maigualida... you're an English Teacher make it easy for us with a clear question?!? =) – pgSystemTester Aug 12 '22 at 00:17
  • @pgSystemTester Good point! Please make the question easy to interpret, also please note that questions generally will not be answered if you do not make some attempt to solve yourself... I've just never written a script for PowerPoint, so found it interesting. – Cameron Critchlow Aug 12 '22 at 00:20
  • 1
    me too... I voted to close but was also curious about ppt objects. [How to ask a question](https://stackoverflow.com/help/how-to-ask) – pgSystemTester Aug 12 '22 at 00:21
  • 1
    Hm... I can't think of a case where the single amended `<> LCase()` statement doesn't work. – Cameron Critchlow Aug 12 '22 at 00:22
  • Agreed. I didn't see it. Less is better. And I was just excited to capitalize the `5` in 5 o'clock happy hour... – pgSystemTester Aug 12 '22 at 00:24
  • Hey you seem like a nice guy, [Check out this bit I wrote I'm quite proud of](https://stackoverflow.com/questions/73322959/how-to-extract-a-plain-text-file-from-word/73327122#73327122) I think it's going to be relegated to the discarded bin, but it was fun to write. – Cameron Critchlow Aug 12 '22 at 00:30
  • 1
    Upvoted. It's the journey of producing the answer, not if it gets (or at least that's what I tell myself when I'm bitter I didn't get any upvotes for a viable solution I produced). The post I've poured the most work/fun into [is here](https://stackoverflow.com/questions/46509572/excel-formula-based-function-for-sha256-sha512-hashing-without-vba-or-macros/56767828#56767828). – pgSystemTester Aug 12 '22 at 00:43
  • 1
    Cheers! Very impressive. No idea what I'm looking at. You're doing data encryption/decryption? – Cameron Critchlow Aug 12 '22 at 00:53