Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88054

ActiveX error in VBA code to replace words in a Powerpoint

$
0
0

I have a VBA code which is supposed to replace a word by another in a powerpoint. Nevertheless, when I try to run it I get the error 429 "ActiveX component can't create object" but I do not know why. Here is the code :

Sub pres()

    Dim PowerPointApp As Object
    Set PowerPointApp = CreateObject("PowerPoint.Application")

    Dim myPres As Object
    Set myPres = PowerPointApp.Presentations.Open("C:\Users\NAME\Desktop\PRESVBA\Pres.pptx")

    Dim sld As Slide
    Set sld = ActivePresentation.Slides(3)
    Dim shp As Shape

    For Each shp In sld.Shapes
    If shp.HasTextFrame Then
        If shp.TextFrame.HasText Then
            shp.TextFrame.TextRange.Text = Replace(shp.TextFrame.TextRange.Text, "Montant", "Amount")
     End If
    End If
    Next shp
End Sub

Viewing all articles
Browse latest Browse all 88054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>