Solved

Programmatically change PowerPoint picture placeholder from rectangle to oval?

Posted on 2014-02-01
3
870 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: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
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
JSRWilson earned 300 total points
ID: 39827368
'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:Bryce Bassett
ID: 39831432
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
ID: 39831812
You'd be amazed how many folk don't think declaring variables correctly is important! (Well maybe not)
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

A lot of things can happen during a presentation, worst of which is “death by PowerPoint.” Here are a few mistakes to avoid to make your slides clean.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
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 a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

690 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