none
Is there a way to restrict the user from not using more than 8 bullets per list in an active document? Or is there a way to affect a users readability score cause of this? RRS feed

  • Question

  • Hi All,

    I'am working with a requirement that says 

    "Assures no bullet list exceeds 8 items"

    -          The ‘bullet list’ in this case refers specifically to unordered /default bullet lists. Whole document excluding tables. , so if there is a way to tag these when that button is used to add the bullet list, and then search the document for these tagged lists and only analyze those ones for the ‘8 step rule’

    Please let me know as I'am stuck on these for days. 

    Friday, October 10, 2014 8:55 AM

Answers

  • Hi Apoorva,

    You could check whether the selected paragraphs’ count are more than eight, if that is the case, give a warning message.

    To add the bullets:

    Dim pc As Integer
    pc = ActiveWindow.Selection.Range.Paragraphs.Count
    If pc >= 8 Then
    With ActiveWindow.Selection.Range
        Range(.Paragraphs(1).Range.Start, .Paragraphs(8).Range.End).ListFormat.ApplyListTemplateWithLevel ListGalleries(wdNumberGallery).ListTemplates(1), ContinuePreviousList:= _
            False, ApplyTo:=wdListApplyToWholeList, DefaultListBehavior:= _
            wdWord10ListBehavior
    MsgBox "You selected more than 8 paragraphs, the style just apply for the first 8 paragraphs"
    End With
    End If
    

    About check bullets, you could check the specify range whether there are bullets and give a warning message if there are more than eight bullets in it.

     Dim rngTarget As Word.Range
        Dim oPara As Word.Paragraph
    
        Set rngTarget = Selection.Range
        MsgBox rngTarget
        With rngTarget
            Call .Collapse(wdCollapseEnd)
            .End = ActiveDocument.Range.End
        Dim BC As Integer
        BC = 0
            For Each oPara In .Paragraphs
                If oPara.Range.ListFormat.ListType = _
                   WdListType.wdListSimpleNumbering Then
                    oPara.Range.Select
                    BC = 1 + BC
                    'Exit For
                ElseIf BC > 8 Then
                  MsgBox "more than 8 bullets"
                  BC = 0
                End If
            Next
        End With

    There is a link that may benefit you:

    # Finding Formatted Bulleted Paragraphs

    http://wordribbon.tips.net/T008259_Finding_Formatted_Bulleted_Paragraphs.html

    Best Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 13, 2014 10:04 AM
    Moderator
  • Hi Apoorva,

    You could select corresponding part or change the color etc… if there is more than eight bullets in it.

    For example:

    Sub FindBullet()
        Dim rngTarget As Word.Range
        Dim oPara As Word.Paragraph
    
        Set rngTarget = Selection.Range
        'MsgBox rngTarget
        With rngTarget
            Call .Collapse(wdCollapseEnd)
            .End = ActiveDocument.Range.End
        Dim BC As Integer
        BC = 0
        Dim s As Integer
        Dim e As Integer
            For Each oPara In .Paragraphs
                If oPara.Range.ListFormat.ListType = _
                   WdListType.wdListSimpleNumbering Then
                    If BC = 0 Then
                     s = oPara.Range.start
                    End If
                    'oPara.Range.Select
                    BC = 1 + BC
                    'Exit For
                 ElseIf BC > 8 Then
                     MsgBox "more than 8 bullets"
                     e = oPara.Range.start - 1
                     Range(s, e).Select
                     BC = 0
                End If
            Next
        End With
    End Sub

    Best Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 15, 2014 9:49 AM
    Moderator

All replies

  • Hi Apoorva,

    According to your description, I would like to know do you have a user form with a button to add bullet list to the document.

    On the other hand, how do you want to analyze those ones for 8 step rule? Do you mean if some bullet list have more than eight items, it need to give the warning message?

    Best Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 13, 2014 2:17 AM
    Moderator
  • Hi Starain,

    Yes i do have a  bullet ribbon button that adds bullets to the document and for analyzing the 8 step rule , a warning message would do .

    Thanks  a lot :) 

    Monday, October 13, 2014 4:03 AM
  • Hi Apoorva,

    You could check whether the selected paragraphs’ count are more than eight, if that is the case, give a warning message.

    To add the bullets:

    Dim pc As Integer
    pc = ActiveWindow.Selection.Range.Paragraphs.Count
    If pc >= 8 Then
    With ActiveWindow.Selection.Range
        Range(.Paragraphs(1).Range.Start, .Paragraphs(8).Range.End).ListFormat.ApplyListTemplateWithLevel ListGalleries(wdNumberGallery).ListTemplates(1), ContinuePreviousList:= _
            False, ApplyTo:=wdListApplyToWholeList, DefaultListBehavior:= _
            wdWord10ListBehavior
    MsgBox "You selected more than 8 paragraphs, the style just apply for the first 8 paragraphs"
    End With
    End If
    

    About check bullets, you could check the specify range whether there are bullets and give a warning message if there are more than eight bullets in it.

     Dim rngTarget As Word.Range
        Dim oPara As Word.Paragraph
    
        Set rngTarget = Selection.Range
        MsgBox rngTarget
        With rngTarget
            Call .Collapse(wdCollapseEnd)
            .End = ActiveDocument.Range.End
        Dim BC As Integer
        BC = 0
            For Each oPara In .Paragraphs
                If oPara.Range.ListFormat.ListType = _
                   WdListType.wdListSimpleNumbering Then
                    oPara.Range.Select
                    BC = 1 + BC
                    'Exit For
                ElseIf BC > 8 Then
                  MsgBox "more than 8 bullets"
                  BC = 0
                End If
            Next
        End With

    There is a link that may benefit you:

    # Finding Formatted Bulleted Paragraphs

    http://wordribbon.tips.net/T008259_Finding_Formatted_Bulleted_Paragraphs.html

    Best Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 13, 2014 10:04 AM
    Moderator
  • Thanks for the snippet Starain,

    This method works , but is there a way to indicate or mark specifically all those paragraphs which exceeded 8 bullets ? because this method gives a warning message that says 8 bullets exceeded but not able to indicate which para exceeded 8 bullets. 

    Tuesday, October 14, 2014 5:14 PM
  • Hi Apoorva,

    You could select corresponding part or change the color etc… if there is more than eight bullets in it.

    For example:

    Sub FindBullet()
        Dim rngTarget As Word.Range
        Dim oPara As Word.Paragraph
    
        Set rngTarget = Selection.Range
        'MsgBox rngTarget
        With rngTarget
            Call .Collapse(wdCollapseEnd)
            .End = ActiveDocument.Range.End
        Dim BC As Integer
        BC = 0
        Dim s As Integer
        Dim e As Integer
            For Each oPara In .Paragraphs
                If oPara.Range.ListFormat.ListType = _
                   WdListType.wdListSimpleNumbering Then
                    If BC = 0 Then
                     s = oPara.Range.start
                    End If
                    'oPara.Range.Select
                    BC = 1 + BC
                    'Exit For
                 ElseIf BC > 8 Then
                     MsgBox "more than 8 bullets"
                     e = oPara.Range.start - 1
                     Range(s, e).Select
                     BC = 0
                End If
            Next
        End With
    End Sub

    Best Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 15, 2014 9:49 AM
    Moderator
  • thanks a lot Satarain, I got an idea after reading this as to how to go about this :)
    Saturday, October 18, 2014 4:11 AM