Arunraj Sekar
asked on
Need Vba Code to a find a period which have in end of the bullet points
Hi Expert,
We are working in PowerPoint with huge of slides...
I am trying to check at end of the all bulleted points have Period, colon, Semicolon, and Comma are there or not. if it is there means I need to highlight that one via VBA... (because as per our standards we should not kept any puntuvation at end of the bullet points, this was very painful while doing quality control)
is it possible to do via VBA PowerPoint?
kindly any expert help me...
We are working in PowerPoint with huge of slides...
I am trying to check at end of the all bulleted points have Period, colon, Semicolon, and Comma are there or not. if it is there means I need to highlight that one via VBA... (because as per our standards we should not kept any puntuvation at end of the bullet points, this was very painful while doing quality control)
is it possible to do via VBA PowerPoint?
kindly any expert help me...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Rgonzo1971, your concept is absolutely right. But it shows empty msgbox.. it nothing find in that msg box
Could you send a dummy?
This code is just "top of my head" so you will need to test and maybe make some small changes but it should get you on the right track.
Sub chexPunct()
Dim osld As Slide
Dim oshp As Shape
Dim L As Long
Dim strReport As String
Dim iRow As Integer
Dim Icol As Integer
Dim G As Long
Dim otr As TextRange
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoGroup Then
For G = 1 To oshp.GroupItems.Count
If oshp.GroupItems(G).HasTextFrame Then
If oshp.GroupItems(G).TextFrame.HasText Then
For L = 1 To oshp.GroupItems(G).TextFrame.TextRange.Paragraphs.Count
Set otr = oshp.GroupItems(G).TextFrame.TextRange
If hasPunct(otr) Then _
strReport = strReport & "Slide " & osld.SlideIndex & _
" Group " & Chr(34) & oshp.Name & Chr(34) & " has illegal characters in para. " _
& L & vbCrLf
Next L
End If 'TF
End If ' text
Next G
Else
If oshp.HasTable Then
For iRow = 1 To oshp.Table.Rows.Count
For Icol = 1 To oshp.Table.Columns.Count
If oshp.Table.Cell(iRow, Icol).Shape.HasTextFrame Then
If oshp.Table.Cell(iRow, Icol).Shape.TextFrame.HasText Then
For L = 1 To oshp.Table.Cell(iRow, Icol).Shape.TextFrame.TextRange.Paragraphs.Count
Set otr = oshp.Table.Cell(iRow, Icol).Shape.TextFrame.TextRange.Paragraphs(L)
If hasPunct(otr) Then _
strReport = strReport & "Slide " & osld.SlideIndex & _
" Table " & Chr(34) & oshp.Name & Chr(34) & " has illegal characters in para. " _
& L & vbCrLf
Next L
End If
End If
Next Icol
Next iRow
Else
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
For L = 1 To oshp.TextFrame.TextRange.Paragraphs.Count
Set otr = oshp.TextFrame.TextRange.Paragraphs(L)
If hasPunct(otr) Then _
strReport = strReport & "Slide " & osld.SlideIndex & _
" Shape " & Chr(34) & oshp.Name & Chr(34) & " has illegal characters in para. " _
& L & vbCrLf
Next L
End If
End If
End If ' not table
End If 'not group
Next oshp
Next osld
MsgBox strReport
End Sub
Function hasPunct(otr As TextRange) As Boolean
If otr.ParagraphFormat.Bullet.Type <> ppBulletNone Then
Select Case otr.Words(otr.Words.Count)
Case Is = ".", ",", ":", ";"
hasPunct = True
End Select
Else
hasPunct = False
End If
End Function
ASKER
I have attached a file with example including a code with required output explained in outside of the slide. kindly look it for clear idea about my question.
Orphan-and-Puntuation.pptx
Orphan-and-Puntuation.pptx
ASKER