Bonjour à vous,

J'utilise une macro qui cherche du texte et le remplace dans un fichier ppt : cela me permet de créer des documents ppt personnalisés rapidement.
Ces derniers jours, j'ai essayé de rajouter des tableaux dans mon ppt et j'ai découvert que ma sub ne va pas dans les cellules de mon tableau pour trouver et remplacer le texte.

En fait ma Sub va dans les slides, puis dans les shapes, puis dans les textframes et cherche le texte pour le remplacer si besoin.

Je souhaiterais que ma sub aille également dans les tableaux en plus des textframes mais je ne sais pas comment faire !
merci beaucoup par avance à ceux qui m'aideront !

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Sub Switch(pptDoc As PowerPoint.Presentation, FindString As String, ReplaceString As Variant)
    With pptDoc
        For Each oSld In .Slides
            For Each oShp In oSld.Shapes
                If oShp.HasTextFrame Then
                    If oShp.TextFrame.HasText Then
                        Set oTxtRng = oShp.TextFrame.TextRange
                        Set oTxtFnd = oTxtRng.Find(FindWhat:=FindString)
 
                        Do While Not oTxtFnd Is Nothing
                        Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, Replacewhat:=ReplaceString, After:=0, MatchCase:=True, WholeWords:=False)
                        Set oTxtFnd = oTxtRng.Find(FindWhat:=FindString)
                        Loop
 
                Else:   Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, Replacewhat:=ReplaceString, After:=0, MatchCase:=True, WholeWords:=False)
                        Do While Not oTmpRng Is Nothing
                        Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, Replacewhat:=ReplaceString, After:=0, MatchCase:=True, WholeWords:=False)
                        Loop
 
                    End If
                End If
            Next oShp
        Next oSld
    End With
End Sub