Solved

Why does applying shadow to a group of PowerPoint shapes programmatically with VBA apply it to the group items?

Posted on 2016-09-09
3
110 Views
Last Modified: 2016-09-12
I'm using PowerPoint 2016 (PC) to add two standard rectangles to a slide via the UI.

If I group them, select the groups and then add the preset shadow type type Perspective Upper Left, I get this result:

Shadow applied to a group of shapes via PowerPoint UI
If I then open the VBE and query the shadow type with:

?ActiveWindow.Selection.ShapeRange(1).Shadow.Type

Open in new window


I get 39 which equates to the enumeration constant msoShadow39

With the group selected, if I now set the shadow to none and try to apply it programatically with this:

ActiveWindow.Selection.ShapeRange(1).Shadow.Type=msoShadow39

Open in new window


I get a result which is equivalent to applying the shadow separately to each of the shapes within the group rather than the group as a whole and this is confirmed when looking at the shape properties in the PowerPoint UI:

Shadow applied to a group of shapes via PowerPoint VBA
Why is this happening?
0
Comment
Question by:Jamie Garroch
3 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 41791211
Hi,

I cannot say why but the only workaround that I see is to group the shapes, cut the group and paste it at the same position as a picture before using the shadow.

it seems that vba recognize the children and like if you were selecting the group and the individual shapes too, you would get the wrong result as well.

Regards
0
 
LVL 23

Assisted Solution

by:JSRWilson
JSRWilson earned 250 total points
ID: 41791516
Why? Who can see into the minds of MSFT programmers. I can tell you though that it has always been that way so if it is a bug I doubt it will be fixed anytime soon.

If you copy and paste the group as an EMF you will get the first result with code (useless info)
0
 
LVL 10

Author Comment

by:Jamie Garroch
ID: 41793837
Thanks guys. FYI, I was "playing" around with a 3D automation idea and the original example above is an overly simplified extract of what I was trying to achieve to demo the issue I was facing. This video illustrates why I needed to keep the original PowerPoint shapes and not convert them:
https://www.dropbox.com/s/skw90gocd1fztwv/3D%20arc%20spiral.mp4?dl=0
Oh well, another idea in the trash thanks to buggy VBA!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question