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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now