Consulting

Results 1 to 3 of 3

Thread: Apply custom bullets to include selected Groups of text boxes

  1. #1
    VBAX Contributor
    Joined
    Dec 2018
    Location
    South London
    Posts
    115
    Location

    Apply custom bullets to include selected Groups of text boxes

    Hi John

    Back in 2018 you helped with this code, just wondering how I can make it also work on selected Grouped text boxes (it works well on shapes that aren't in a Group). Thank you

    Sub BulletText10()
    
    
    Dim L As Long
    Dim oshp As shape
    Set oshp = ActiveWindow.Selection.ShapeRange(1)
    If oshp.HasTextFrame Then
    If oshp.TextFrame2.HasText Then
    With oshp.TextFrame2.textRange
    For L = 1 To .Paragraphs.Count
    Select Case .Paragraphs(L).ParagraphFormat.IndentLevel
    Case Is = 1 ' note the FirstLine Indent is constant
    .Paragraphs(L).ParagraphFormat.FirstLineIndent = cm2Points(-0.5)
    .Paragraphs(L).ParagraphFormat.LeftIndent = cm2Points(0.5)
    .Paragraphs(L).ParagraphFormat.Bullet.Font.Name = "WingDings"
    .Paragraphs(L).ParagraphFormat.Bullet.Character = 167
    .Paragraphs(L).ParagraphFormat.Bullet.Font.Fill.ForeColor.RGB = RGB(255, 0, 0)
    
    
    
    
    Case Is = 2
    .Paragraphs(L).ParagraphFormat.FirstLineIndent = cm2Points(-0.5)
    .Paragraphs(L).ParagraphFormat.LeftIndent = cm2Points(1#)
    .Paragraphs(L).ParagraphFormat.Bullet.Font.Name = "Arial"
    .Paragraphs(L).ParagraphFormat.Bullet.Character = 8211
    .Paragraphs(L).ParagraphFormat.Bullet.Font.Fill.ForeColor.RGB = RGB(255, 0, 0)
    
    
    
    
    Case Is = 3
    .Paragraphs(L).ParagraphFormat.FirstLineIndent = cm2Points(-0.5)
    .Paragraphs(L).ParagraphFormat.LeftIndent = cm2Points(1.5)
    .Paragraphs(L).ParagraphFormat.Bullet.Font.Name = "WingDings"
    .Paragraphs(L).ParagraphFormat.Bullet.Character = 167
    .Paragraphs(L).ParagraphFormat.Bullet.Font.Fill.ForeColor.RGB = RGB(255, 0, 0)
    
    
    
    
    End Select
    Next L
    End With
    End If
    End If
    End Sub

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    You could make this more modular and combine the Grouped and Not Grouped macros

    Also no error checking


    Sub BulletTextGrouped()
    
    
        Dim L As Long, G As Long
        Dim oshp As Shape, oshp2 As Shape
        
        Set oshp = ActiveWindow.Selection.ShapeRange(1)
        
        For Each oshp2 In oshp.GroupItems
            If oshp2.HasTextFrame Then
                If oshp2.TextFrame2.HasText Then
                    With oshp2.TextFrame2.TextRange
                        For L = 1 To .Paragraphs.Count
                            Select Case .Paragraphs(L).ParagraphFormat.IndentLevel
                                Case Is = 1 ' note the FirstLine Indent is constant
                                    .Paragraphs(L).ParagraphFormat.FirstLineIndent = cm2Points(-0.5)
                                    .Paragraphs(L).ParagraphFormat.LeftIndent = cm2Points(0.5)
                                    .Paragraphs(L).ParagraphFormat.Bullet.Font.Name = "WingDings"
                                    .Paragraphs(L).ParagraphFormat.Bullet.Character = 167
                                    .Paragraphs(L).ParagraphFormat.Bullet.Font.Fill.ForeColor.RGB = RGB(255, 0, 0)
        
                                Case Is = 2
                                    .Paragraphs(L).ParagraphFormat.FirstLineIndent = cm2Points(-0.5)
                                    .Paragraphs(L).ParagraphFormat.LeftIndent = cm2Points(1#)
                                    .Paragraphs(L).ParagraphFormat.Bullet.Font.Name = "Arial"
                                    .Paragraphs(L).ParagraphFormat.Bullet.Character = 8211
                                    .Paragraphs(L).ParagraphFormat.Bullet.Font.Fill.ForeColor.RGB = RGB(255, 0, 0)
        
                                Case Is = 3
                                    .Paragraphs(L).ParagraphFormat.FirstLineIndent = cm2Points(-0.5)
                                    .Paragraphs(L).ParagraphFormat.LeftIndent = cm2Points(1.5)
                                    .Paragraphs(L).ParagraphFormat.Bullet.Font.Name = "WingDings"
                                    .Paragraphs(L).ParagraphFormat.Bullet.Character = 167
                                    .Paragraphs(L).ParagraphFormat.Bullet.Font.Fill.ForeColor.RGB = RGB(255, 0, 0)
                            End Select
                        Next L
                    End With
                End If
            End If
        Next
    End Sub
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Contributor
    Joined
    Dec 2018
    Location
    South London
    Posts
    115
    Location
    Thanks Paul, and for the attachment, really helpful! Have a great day!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •