thanks in advance.
I have 44 shapes on a slide (B01 - B44) that I want to check to see if they DO NOT contain the letter "A". There are other shapes that I want to exclude from the search. I would like to do this without a bunch of "and"s but I'm somewhat new to VBA.
Something like:
If ActivePresentation.Slides(2).Shapes("B##").TextFrame.TextRange.Text <> "A" Then MsgBox "No A's"
You can do this in a loop:
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
Note: This checks to see if the text is "A", not whether it contains the letter "A".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.