工具/原料
电脑 ppt
方法/步骤
1、首先,打开需要编辑谨则的ppt文档。
2、然后,将鼠标光标放到当前页P,右击鼠标,含晌凳弹出菜单中点击“设置背景谈旅格式”。
3、最后,在此界面,左侧选择“纯色填充”,依次将相同的图片除即可。
1、在要运行的PPT文件中,打开“文件”薯腊菜单,点击“选项”;
2、在“选项”对话框中,点击“信任中心”,然后点击“高尺信任中心设置”按钮;
3、在“信任中心设置”对话框中,选择“宏设置”选项,然后将戚手高“启用所有宏”设置为“启用”;
4、最后点击“确定”按钮,即可使宏在所有文件中运行。
复制下面宏,使用时点击宏中的“批量替换”即可:
注意:使用前请把谨燃谨要替换的PPT文件复制到同一祥基目录下,以便集中替换。
Sub 批量替换()
Dim ChangedCount As Integer
Dim FileName As String, Mask As String
Dim FindCount As Long
Dim CurPresentation As Presentation
Dim Path As String, FindString As String, ReplaceString As String
Dim oSld As Slide
Dim oShp As Shape
Dim oTxtRng As TextRange
Dim oTmpRng As TextRange
Path = InputBox("请输入路径名称:", "参数输入(1/3)")
FindString = InputBox("请输入查找文本:", "参段运数输入(2/3)")
ReplaceString = InputBox("请输入替换文本:", "参数输入(3/3)")
If Path = "" Or FindString = "" Or ReplaceString = "" Then
MsgBox "每个参数均不能为空!", vbCritical, "出错"
Exit Sub
End If
ChangedCount = 0
FindCount = 0
Mask = "*.ppt"
If Right(Path, 1) "\" Then Path = Path "\"
FileName = Dir(Path Mask)
On Error Resume Next
Err.Clear
Do Until FileName = ""
DoEvents
Set CurPresentation = Presentations.Open(FileName:=Path FileName, ReadOnly:=msoFalse, WithWindow:=msoFalse)
For Each oSld In CurPresentation.Slides
For Each oShp In oSld.Shapes
Err.Clear
Set oTxtRng = oShp.TextFrame.TextRange
If Err.Number = 0 Then
Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, _
Replacewhat:=ReplaceString, MatchCase:=False, _
WholeWords:=True)
If oTmpRng Is Nothing Then oTxtRng = Replace(oTxtRng, FindString, ReplaceString, , , vbTextCompare)'解决中文无法替换问题(下同)
Do While Not oTmpRng Is Nothing
FindCount = FindCount + 1
Set oTxtRng = oTxtRng.Characters(oTmpRng.Start + oTmpRng.Length, _
oTxtRng.Length)
Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, _
Replacewhat:=ReplaceString, MatchCase:=False, _
WholeWords:=True)
If oTmpRng Is Nothing Then oTxtRng = Replace(oTxtRng, FindString, ReplaceString, , , vbTextCompare)
Loop
End If
Next oShp
Next oSld
CurPresentation.Save
CurPresentation.Close
FileName = Dir
Loop
MsgBox "替换完毕!"
Close
End Sub
打开ppt在视图中选择宏(早期版本可能要在插入中找),输入任意的宏名,点击创建。
在新代码窗口中,删除原来的内容,并复制以下内容,然后运行宏
点击左上角菜单,选择PPT选项如坦启
信任中心-宏设置,选中启用所有和信哪信任对VBA的访问,确定渣如。然后重启PPT即可
本文转载自互联网,如有侵权,联系删除