PDA

View Full Version : Adjusting Bullets



Rathish
02-25-2013, 06:14 AM
Hi,
I am trying to create a macro to set bullet. If i select a text and click a button e.g 2nd bullet it applies 2nd level bullet.
I am trying for
1st bullet :- left 0.18 and hanging 0.18
2nd bullet :- left 0.39 and hanging 0.2
3rd bullet :- left 0.59 and hanging 0.18
4th bullet :- left 0.78 and hanging 0.18

However i am not able to understand or set the bullet level given below. Can any one please make me understand how i can get the above said indentation (bullet leveling).

.IndentLevel = 3
With .Parent.Ruler
.Levels(1).FirstMargin = 0
.Levels(1).FirstMargin = 0
.Levels(1).LeftMargin = 0
.Levels(2).FirstMargin = 0
.Levels(2).LeftMargin = 20.8465
.Levels(3).FirstMargin = 44.1
.Levels(3).LeftMargin = 37.1
End With


Thanks
rathish

Rathish
03-01-2013, 08:17 PM
I am trying to create a macro to set bullet. If i select a text and click a button e.g 2nd bullet it applies 2nd level bullet.
I am trying for
1st bullet :- left 0.18 and hanging 0.18
2nd bullet :- left 0.39 and hanging 0.2
3rd bullet :- left 0.59 and hanging 0.18
4th bullet :- left 0.78 and hanging 0.18


Sub fst_bullet()
On Error Resume Next
Err.Clear
Dim oText As TextRange
'Require the users to select some text
Set oText = ActiveWindow.Selection.TextRange
If Err.Number <> 0 Then
MsgBox "Invalid Selection. Please highlight some text " _
& "or select a text frame and run the macro again.", vbExclamation
End
End If
'Display the selected text in a message box
If oText.Text = "" Then
MsgBox "No Text Selected.", vbInformation
Else
MsgBox oText, vbInformation
End If
With oText
.ParagraphFormat.SpaceAfter = 3
.ParagraphFormat.SpaceAfter = 3
.ParagraphFormat.Alignment = ppAlignLeft
.IndentLevel = 2
With .Parent.Ruler
.Levels(1).FirstMargin = 0
.Levels(1).LeftMargin = 0
.Levels(2).FirstMargin = 0
.Levels(2).LeftMargin = 12.8465
.Levels(3).FirstMargin = 28.3465
.Levels(3).LeftMargin = 56.6929
End With
With .ParagraphFormat.Bullet
.Visible = msoCTrue
.RelativeSize = 1
.Character = 167
With .Font
.Color.RGB = RGB(0, 152, 199)
.Name = "Wingdings"
End With
End With
With .Font
.Name = "Arial"
.Bold = msoFalse
.Color.RGB = RGB(78, 70, 65)
.Size = 12
End With
End With
End Sub
Sub scnd_bullet()
On Error Resume Next
Err.Clear
Dim oText As TextRange
'Require the users to select some text
Set oText = ActiveWindow.Selection.TextRange
If Err.Number <> 0 Then
MsgBox "Invalid Selection. Please highlight some text " _
& "or select a text frame and run the macro again.", vbExclamation
End
End If
'Display the selected text in a message box
If oText.Text = "" Then
MsgBox "No Text Selected.", vbInformation
Else
MsgBox oText, vbInformation
End If
With oText
.ParagraphFormat.SpaceAfter = 3
.ParagraphFormat.SpaceAfter = 3
.ParagraphFormat.Alignment = ppAlignLeft
.IndentLevel = 3
With .Parent.Ruler
.Levels(1).FirstMargin = 0
.Levels(1).FirstMargin = 0
.Levels(1).LeftMargin = 0
.Levels(2).FirstMargin = 0
.Levels(2).LeftMargin = 20.8465
.Levels(3).FirstMargin = 42.1
.Levels(3).LeftMargin = 27.6929
End With
With .ParagraphFormat.Bullet
.Visible = msoCTrue
.RelativeSize = 1
.Character = 167
With .Font
.Color.RGB = RGB(172, 43, 55)
.Name = "Wingdings"
End With
End With
With .Font
.Name = "Arial"
.Bold = msoFalse
.Color.RGB = RGB(78, 70, 65)
.Size = 12
End With
End With
End Sub