Hello all,

I'm learning PowerPonit VBA. Recently I got stuck at problem. I have two different presentations. First one: Title and subtitle are the same text box ("Title") Second one: Title and subtitle are two different text boxes. Main purpose is to check colour RGB values for title and subtitle. I tried different approaches and separately it works. I think I don't understand and make a mistake in if function. I think code always "sees" Title although there is Else. Separately it works but I can't make it work together: Check if there is textbox "Subtitle" if yes check colours for two textboxes if not check colour for "Title" first paragraph and second "Paragraph". I'm not also sure if with For function I'm checking every slide from beginning including master slide? Thanks in advance for your help.


With shpSlide2    
        .TextFrame.TextRange.Font.Color.RGB = RGB(255, 255, 255)
        .TextFrame.TextRange.Font.Size = 7
        .TextFrame.TextRange.Font.Bold = True
                       
        'For Each shp In ActiveDesigns.SlideMaster.Shape
        For Each Slide In ActivePresentation.Slides
        For Each shp In Slide.Shapes
        
        Set shp2 = Shape
                  
        If shp.HasTextFrame And shp.Name Like "Subtitle" = True Then
        
        N = shp.TextFrame.TextRange.Font.Color
                 
        B = N \ 65536
        G = (N - B * 65536) \ 256
        R = N - B * 65536 - G * 256
        
        .TextFrame.TextRange.Characters.Text = "Subtitle: " & "R:" & R & " G:" & G & " B:" & B
        .Fill.ForeColor.RGB = N
     
        Else
        
        If shp.Name Like "Subtitle*" = False And shp2.HasTextFrame And shp2.Name Like "Title*" Then
        
        N = shp2.TextFrame.TextRange.Paragraphs(2).Characters(1).Font.Color
        
        B = N \ 65536
        G = (N - B * 65536) \ 256
        R = N - B * 65536 - G * 256
        
        .TextFrame.TextRange.Characters.Text = "Subtitle: " & "R:" & R & " G:" & G & " B:" & B
        .Fill.ForeColor.RGB = N




        End If
        End If
        Next
        Next
                
    End With