Link to home
Start Free TrialLog in
Avatar of LC7Web
LC7Web

asked on

borders and shading styles

Is there a way to specify borders and shading styles for images within a word document?  As i have over 100 images i would like to apply a style for.  
I am using word 2003.

ASKER CERTIFIED SOLUTION
Avatar of Joanne M. Orzech
Joanne M. Orzech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LC7Web
LC7Web

ASKER

How exaclty do you specify what to search for?
Avatar of LC7Web

ASKER

If i use the Find and Replace dialog to search for Special>Graphic
How do i specify replace ^g with the new macro i created?
Here LC7 - just try this - this combines the two macros - just run it (providing you don't already have a style called "Image"):

Sub Image()
    ActiveDocument.Styles.Add Name:="Image", Type:=wdStyleTypeParagraph
    With ActiveDocument.Styles("Image")
        .AutomaticallyUpdate = False
        .BaseStyle = "Normal"
        .NextParagraphStyle = "Image"
    End With
    With ActiveDocument.Styles("Image").Font
    With ActiveDocument.Styles("Image").ParagraphFormat
    End With
    ActiveDocument.Styles("Image").ParagraphFormat.TabStops.ClearAll
    With ActiveDocument.Styles("Image").ParagraphFormat
        With .Shading
            .Texture = wdTextureNone
            .ForegroundPatternColor = wdColorAutomatic
            .BackgroundPatternColor = wdColorAutomatic
        End With
        With .Borders(wdBorderLeft)
            .LineStyle = wdLineStyleSingle
            .LineWidth = wdLineWidth225pt
            .Color = wdColorBlue
        End With
        With .Borders(wdBorderRight)
            .LineStyle = wdLineStyleSingle
            .LineWidth = wdLineWidth225pt
            .Color = wdColorBlue
        End With
        With .Borders(wdBorderTop)
            .LineStyle = wdLineStyleSingle
            .LineWidth = wdLineWidth225pt
            .Color = wdColorBlue
        End With
        With .Borders(wdBorderBottom)
            .LineStyle = wdLineStyleSingle
            .LineWidth = wdLineWidth225pt
            .Color = wdColorBlue
        End With
        With .Borders
            .DistanceFromTop = 1
            .DistanceFromLeft = 4
            .DistanceFromBottom = 1
            .DistanceFromRight = 4
            .Shadow = True
        End With
    End With
    Selection.Style = ActiveDocument.Styles("Image")
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    Selection.Find.Style = ActiveDocument.Styles("Normal")
    Selection.Find.ParagraphFormat.Borders.Shadow = False
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Style = ActiveDocument.Styles("Image")
    Selection.Find.Replacement.ParagraphFormat.Borders.Shadow = False
    With Selection.Find
        .Text = "^g"
        .Replacement.Text = ""
        .Forward = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Avatar of LC7Web

ASKER

Great, thanks!
Thanks much LC!