Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Programmatically change PowerPoint picture placeholder from rectangle to oval?

Posted on 2014-02-01
3
Medium Priority
?
888 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 1200 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

636 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