View Single Post
 
Old 10-30-2018, 04:24 PM
14spar15 14spar15 is offline Windows XP Office 2000
Competent Performer
 
Join Date: Mar 2011
Posts: 100
14spar15 is on a distinguished road
Default Modify macro to only add bullets to highlighted text if it exists.

This macro works fine if before running it I highlight the text lines that I want to have bullets. It adds bullets to theses highlighted lines and then converts all of the text in this text box (including bulleted lines) to the desired font and size. I would like to change it so that if it happens that nothing is highlighted no bullets are added and it just moves on to converts all of the text in this text box to the desired font and size. What is happening now is, if nothing is highlighted it is adding one unwanted bullet at the beginning of all the text in my text box.

Code:
Sub Macro3()

    With ListGalleries(wdBulletGallery).ListTemplates(1).ListLevels(1)
        .NumberFormat = ChrW(61623)
        .TrailingCharacter = wdTrailingTab
        .NumberStyle = wdListNumberStyleBullet
        .NumberPosition = InchesToPoints(0.25)
        .Alignment = wdListLevelAlignLeft
        .TextPosition = InchesToPoints(0.5)
        .TabPosition = wdUndefined
        .ResetOnHigher = 0
        .StartAt = 1
        With .Font
            .Bold = wdUndefined
            .Italic = wdUndefined
            .StrikeThrough = wdUndefined
            .Subscript = wdUndefined
            .Superscript = wdUndefined
            .Shadow = wdUndefined
            .Outline = wdUndefined
            .Emboss = wdUndefined
            .Engrave = wdUndefined
            .AllCaps = wdUndefined
            .Hidden = wdUndefined
            .Underline = wdUndefined
            .Color = wdUndefined
            .Size = wdUndefined
            .Animation = wdUndefined
            .DoubleStrikeThrough = wdUndefined
            .Name = "Symbol"
        End With
        .LinkedStyle = ""
    End With
    ListGalleries(wdBulletGallery).ListTemplates(1).Name = ""
    Selection.Range.ListFormat.ApplyListTemplateWithLevel ListTemplate:= _
        ListGalleries(wdBulletGallery).ListTemplates(1), ContinuePreviousList:= _
        False, ApplyTo:=wdListApplyToSelection, DefaultListBehavior:= _
        wdWord10ListBehavior
    Selection.WholeStory
    Selection.Font.Size = 18
End Sub
Reply With Quote