1

提前致谢。

我在一张幻灯片 (B01 - B44) 上有 44 个形状,我想检查它们是否不包含字母“A”。我想从搜索中排除其他形状。我想在没有一堆“和”的情况下做到这一点,但我对 VBA 有点陌生。

就像是:

If ActivePresentation.Slides(2).Shapes("B##").TextFrame.TextRange.Text <> "A" Then MsgBox "No A's"
4

1 回答 1

0

您可以循环执行此操作:

Dim i as Long, a As Long
Dim shp as Shape
Dim pres as Pres: Set  pres = ActivePresentation

For i = 1 to 44
    Set shp = pres.Slides(2).Shapes("B" & i)
    If shp.TextFrame.TextRange.Text <> "A" Then
        aCount = aCount+1
    End If
Next

If aCount = 0 Then 
    MsgBox "No A's were found"
Else:
    MsgBox aCount & " A's were found"
End If

注意:这将检查文本是否为“A”,而不是它是否包含字母“A”。

于 2013-06-24T19:50:01.840 回答