?
Solved

Programmatically change default shape in PowerPoint

Posted on 2013-05-21
4
Medium Priority
?
495 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

 Regular Expressions Microsoft Word has sophisticated search tools that can search for patterns. For example if you wanted to search for all UK phone numbers that followed a pattern of five digits, a space and then six digits you can easily do th…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
This video teaches viewers how to add simple and professional themes to their slides.
The viewer will learn how to edit animations within the presentation, incorporate sound, and set everything up with timing.

719 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