这将适用于一个通配符;您需要将其更改为采用参数(您正在搜索的不同通配符文本字符串)或调用另一个例程来轮流搜索每个通配符。但这里是你如何在单元格中找到文本并根据需要进行着色:
Dim oSl As Slide
Dim oSh As Shape
Dim oTbl As Table
Dim x As Long
Dim y As Long
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
' other code here to check for ## text in the shape
If oSh.HasTable Then
Set oTbl = oSh.Table
With oTbl
For x = 1 To .Rows.Count
For y = 1 To .Columns.Count
With .Cell(x, y)
If InStr(.Shape.TextFrame.TextRange.Text, "##budget##") > 0 Then
.Shape.Fill.ForeColor.RGB = RGB(255, 0, 0)
End If
End With
Next
Next
End With
End If
Next
Next
感谢此示例史蒂夫! 我不知道的是,如果有方法可以识别,在oTbl中是否是一个项目符号列表并在其中标识通配符? – user615993
无论表格单元格中有什么文字,我都认为这应该起作用。 oTbl对象本身不能包含文本,只能包含可能包含文本的单元格。 –