Solved

Programmatically change default shape in PowerPoint

Posted on 2013-05-21
4
492 Views
Last Modified: 2013-06-01
I know I can stylize a shape in PowerPoint, then right-click and "set shape as default."  But I want to provide a client with a toolbar where they can switch to several pre-set shape stylings.  Does anyone know how to programmatically set the default shape properties using VBA, not just once, but potentially multiple times?

Thanks
0
Comment
Question by:Bryce Bassett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 23

Expert Comment

by:JSRWilson
ID: 39186630
There can only be one default.

To get what you want you would need to create an AddIn it would be a lot easier to apply the chosen style to selected shapes.

It would probably create a gallery of shapes on the ribbon and then use the pickup and apply methods to apply the style to a shape.
0
 

Author Comment

by:Bryce Bassett
ID: 39189133
Thanks,

I understand there can only be one default, but if I can set that default programmatically by having the user click a button, no reason I couldn't keep changing it.  

I am in fact creating an Add-In for this client, and am planning to use a gallery approach.

But I don't want the user to have to create a shape, then apply the custom style after the fact.  I'd like it to work like the built-in PowerPoint galleries, where you choose Insert, Shape, select a shape from the gallery, then when you create it, it has the chosen style already in place.  Can you think of a way to do this?

Speaking of which, I found a method to add custom colors to the built-in color picker dialog by adding to the theme1.xml file.  Is there a similar technique to modify built-in PowerPoint galleries?
0
 

Accepted Solution

by:
Bryce Bassett earned 0 total points
ID: 39200252
Found my answer.

There's a shapes method called "SetShapesDefaultProperties"

So, I create a dummy shape, stylize it the way I want, capture those settings as the default shape, then delete the dummy shape.  Thereafter, any shape the user creates has those settings.

Set myshp = ActivePresentation.Slides(showingslide).Shapes.AddShape(msoShapeRectangle, 10, 10, 10, 10)
With myshp
    .Fill.ForeColor.RGB = RGB(102, 0, 102)
    .Line.Visible = msoFalse
    .TextFrame.AutoSize = ppAutoSizeNone
    .TextFrame.TextRange.Font.Size = 18
    .TextFrame.VerticalAnchor = msoAnchorMiddle
    .TextFrame.TextRange.Font.Name = "Verdana"
    .TextFrame.TextRange.Font.Italic = msoFalse
    .TextFrame.TextRange.Font.Bold = msoFalse
    .TextFrame.TextRange.Font.Color.RGB = RGB(255, 255, 255)
    .SetShapesDefaultProperties
End With
myshp.Delete

Open in new window

0
 

Author Closing Comment

by:Bryce Bassett
ID: 39212611
Only one other response, and it was incomplete.
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

People often ask "How do I make this macro run every time I show a new slide or add a new slide etc." This means making PowerPoint respond to that EVENT and, unlike in Excel, it's not that easy! First, I would avoid using the pseudo events left o…
Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
This video teaches viewers how to add transitions to their Slideshows and how to set up timing for the transitions.
The viewer will learn how to edit animations within the presentation, incorporate sound, and set everything up with timing.

623 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