Solved

Programmatically change PowerPoint picture placeholder from rectangle to oval?

Posted on 2014-02-01
3
852 Views
Last Modified: 2014-02-04
I'm building a PowerPoint (2010) template to conform to our new company design.  It includes a lot of round picture placeholders.   Manually, it's easy to create a new slide layout, insert a picture placeholder (which comes in by default as a rectangle), then use change shape to change it to an oval.   I just need to accomplish that with VBA.  The following code creates a new layout and adds the picture placeholder.  

layoutcount = ActivePresentation.Designs(1).SlideMaster.CustomLayouts.Count

Set newlayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts _
    .Add(layoutcount + 1)

Set ph = newlayout.Shapes.AddPlaceholder(ppPlaceholderPicture, _
    Left:=100, Top:=200, Width:=100, Height:=100)

Open in new window


Now how would I change "ph" to an oval?

Thanks
0
Comment
Question by:versatilebb
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
JSRWilson earned 300 total points
Comment Utility
'Declare the variables!
Dim ph As Shape
Dim layoutcount As Long
Dim newlayout As CustomLayout

layoutcount = ActivePresentation.Designs(1).SlideMaster.CustomLayouts.Count

Set newlayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts _
    .Add(layoutcount + 1)

Set ph = newlayout.Shapes.AddPlaceholder(ppPlaceholderPicture, _
    Left:=100, Top:=200, Width:=100, Height:=100)
ph.AutoShapeType = msoShapeOval

Open in new window

0
 

Author Closing Comment

by:versatilebb
Comment Utility
Perfectly simple!

Thanks.

Yes, I always declare my variables and use Option Explicit.  I just was posting a snippet of my code.  But good reminder
0
 
LVL 23

Expert Comment

by:JSRWilson
Comment Utility
You'd be amazed how many folk don't think declaring variables correctly is important! (Well maybe not)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

744 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

16 Experts available now in Live!

Get 1:1 Help Now