便于替换选中对象内的字符
Sub ppt替换选中对象字符()
Dim shape As shape
'Dim TextBox As TextBox
Dim searchStr As String
Dim replaceStr As String
' 设置要搜索和替换的文本
searchStr = " "
replaceStr = ""
' 遍历选中的所有形状
For Each shape In ActiveWindow.Selection.ShapeRange
' 检查形状是否是文本框或矩形框或AutoShapeType
If shape.Type = msoTextBox Or shape.Type = msoShapeRectangle Then
Set TextBox = shape.TextFrame.TextRange
' 替换文本框中的字符
TextBox.Text = Replace(TextBox.Text, searchStr, replaceStr)
End If
Next shape
End Sub