如何使用VBA在Powerpoint中查找和替换字符串 [英] How to find and replace a string in powerpoint using VBA

查看:588
本文介绍了如何使用VBA在Powerpoint中查找和替换字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ppt的幻灯片1上将 hello替换为 world。

I would like to replace the word "hello" with "world" on slide 1 of the ppt. How can I do that using VBA script.

推荐答案

Sub findAndReplaceText()
Dim sld As Slide
Set sld = ActivePresentation.Slides(1)
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, "hello", "world")
    End If
End If
Next shp
End Sub




参考:< a href = https://www.youtube.com/watch?v=BYfKvVmtAGE rel = noreferrer> https://www.youtube.com/watch?v=BYfKvVmtAGE

这篇关于如何使用VBA在Powerpoint中查找和替换字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆