VBA在PPT中批量替换的问题
我想使用VBA在PPT中批量替换文字,比如A换成1,B换成2,C换成3。。。。。。一直到很多,大概就是CTRL+H的意思然后在网上搜索了一下
Sub 宏1()
Dim i, ctrl
'下一行是查找和替换的内容,依次成对填写
ctrl = Array("A", "1", "B", "2", "C", "3")
For i = LBound(ctrl) To UBound(ctrl) - 1 Step 2
Cells.Replace What:=ctrl(i), Replacement:=ctrl(i + 1), LookAt:=xlPart, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Next i
End Sub
并不能用,运行错误,424要求对象
请教,这个应该怎么改 或者这样,怎么把下面这个改成可以连续替换的,比如A换1,B换2,C换3。。。。。。等等等等
Sub yy()
Dim a As Slide
Dim s As Shape
For Each a In ActivePresentation.Slides
For Each s In a.Shapes
If s.HasTextFrame Then
With s.TextFrame
If .TextRange.Text = "源数据" Then
If .HasText Then .TextRange.Text = "十二"
End If
End With
End If
Next
Next
End Sub
页:
[1]