Add shadows quickly to pictures in Publisher

I work with MS Publisher and am familiar with VBA. Every time I put an image into a Publisher document, I want to add “shadow effects” to it. That requires me to select shadows to the right and bottom of the image, as if a light were shining on the picture from above left. A second step is to specify the colour of the shadow. Those are all automatic actions that I do manually.

     Is there any way I can set a default shadow position and colour or else use VBA to have Publisher add the shadows in the right place and colour automatically? I suspect that Publisher does not work with VBA, so that may be out of the question. A solution would save me only about fifteen or twenty seconds for each picture, but since I have to do it hundreds of times a week, the time saved would add up.

     Thanks for any suggestions. I fear the problem may be insolvable, yet I’m optimistic that someone far away from the Rocky Mountains and more experienced than I could solve my query in a trice.

             JRA in Alberta
JohnRobinAllenRetired professor of FrenchAsked:
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.


Publisher has VBA as well

you could record a similar action in Excel, copy the code and transpose it to Publisher

like this

Sub ProcessShapes()
Dim sh As Shape
For Each sh In ActiveDocument.Shapes
With sh
    MsgBox .Name
    With .Shadow
        .Type = msoShadow25
        .Visible = msoTrue
        .Style = msoShadowStyleOuterShadow
        .Blur = 20
        .OffsetX = 8
        .OffsetY = 4
        .RotateWithShape = msoFalse
        .ForeColor.RGB = RGB(0, 0, 0)
        .Transparency = 0.5
        .Size = 100
    End With
End With
End Sub

Open in new window


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
JohnRobinAllenRetired professor of FrenchAuthor Commented:
I have not had time these past three days to test the solution, but I am sure it will work beautifully. If by chance I have any problems when I can get to it, I'll post any queries here or as a separate question.
     Thanks for your help.
JohnRobinAllenRetired professor of FrenchAuthor Commented:
I finally tested the above solution in Publisher and unfortunately it hung up on the word "ActiveDocument". I guess that term refers to Word documents. Could Rgonzo1971 or anyone else tell me what the equivalent word in Publisher would make the routine work?
     If you prefer me to pose the above in a new question, I would be happy to do so. It is just that anyone searching for a solution on how to add shadows to images in Publisher would then not see the corrected routine.
    Thanks for any help.
     JRA in Priddis
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 Office

From novice to tech pro — start learning today.