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.

LVL 1
LC7WebAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Joanne M. OrzechManager, Document Services CenterCommented:
Absolutely!  You can create a style for images and apply that style to all images in your document.  Is this what you're looking for?  It will apply a specific style and border/shading to all images.

If the images are all "normal" style, you should be able to run a search and replace routine which will change the formatting of each image. (Actually, I don't think the images must be all normal but for the sake of discussion, let's say they are).   It would be something like this:

First, record a macro that creates your style (in this case, the style is 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")
End Sub

Then do a search and replace for each photo that has normal style applied and apply the image style:

Sub ApplyImage()
    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
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Or you could combine the two macros - create the style and then apply to all images all at once.  Hope this helps.


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LC7WebAuthor Commented:
How exaclty do you specify what to search for?
0
LC7WebAuthor Commented:
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?
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Joanne M. OrzechManager, Document Services CenterCommented:
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

0
LC7WebAuthor Commented:
Great, thanks!
0
Joanne M. OrzechManager, Document Services CenterCommented:
Thanks much LC!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.