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?
Rgonzo1971Connect With a Mentor Commented:

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

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
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.

All Courses

From novice to tech pro — start learning today.