Log in

View Full Version : [SOLVED:] Apply custom bullets to include selected Groups of text boxes



RayKay
06-13-2023, 02:38 AM
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

Paul_Hossler
06-13-2023, 07:53 PM
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

RayKay
06-15-2023, 01:40 AM
Thanks Paul, and for the attachment, really helpful! Have a great day!