Jamie Garroch (MVP)
asked on
SmartArt shape fill with VBA in PowerPoint, Excel etc.
I am trying to change the format of SmartArt with VBA, more specifically, the fill colour of the AutoShapes that make up the SmartArt object.
I can successfully achieve this by looping through the GroupItems of the SmartArt object but when the item has the picture icon (it doesn't appear to be a standard placeholder object) the picture icon disappears when I set the fill colour as shown in these before and after screen captures for the 3rd SmartArt type, "Picture Caption List":
Here is the simple code snippet when programming in the PowerPoint VBE:
Is there a way to change the picture shape fill without losing the picture icon?
I can successfully achieve this by looping through the GroupItems of the SmartArt object but when the item has the picture icon (it doesn't appear to be a standard placeholder object) the picture icon disappears when I set the fill colour as shown in these before and after screen captures for the 3rd SmartArt type, "Picture Caption List":
Here is the simple code snippet when programming in the PowerPoint VBE:
Dim oShp as Shape
For Each oShp In ActiveWindow.Selection.ShapeRange(1).GroupItems
If oShp.Type = msoAutoShape Then oShp.Fill.ForeColor.RGB = RGB(0, 0, 0)
Next
Is there a way to change the picture shape fill without losing the picture icon?
ASKER
They are active icons for the user to be able to insert pictures into those shapes.
HI,
If you expand the area to change the text (Type your text Here) you will see image icons if you dbl-click them you can select the image you want to insert
Regards
If you expand the area to change the text (Type your text Here) you will see image icons if you dbl-click them you can select the image you want to insert
Regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also worth knowing that the object model is totally different in 2007 from later versions. If they might use 2007 it is almost certain to fail.
Are you using groupitems to attempt to make it 2007 compliant?
Are you using groupitems to attempt to make it 2007 compliant?
ASKER
That's interesting and scary!
I'm using GroupItems as I don't need to worry about the logical hierarchy, just the sub-shape types in order to work out how to format.
I'm using GroupItems as I don't need to worry about the logical hierarchy, just the sub-shape types in order to work out how to format.
ASKER
Ah. "the object model is totally different in 2007" is usually manageable but not now I discovered this from Shyam Pillai:
"The SmartArt model is read-only in PPT 2007. So you can read information
from it by treating it as a kind of group shape but you cannot write to it."
Source : https://groups.google.com/ forum/#!ms g/microsof t.public.p owerpoint/ _jzpBnl1M0 I/uqBWxcEr bPkJ
"The SmartArt model is read-only in PPT 2007. So you can read information
from it by treating it as a kind of group shape but you cannot write to it."
Source : https://groups.google.com/
ASKER
The solution to use the QuickStyle property is a partial answer in that it reset the colours but cannot be used to reset them to anything other than that defined by the presentation's theme.
Why do you want to keep them?
Regards