Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Copying a PowerPoint slide background gradient's brightness using Insert2 method of VBA

Posted on 2014-12-11
2
Medium Priority
?
266 Views
Last Modified: 2014-12-11
I need to copy the gradient of a slide's background fill from one slide to another.

The properties of the source gradient may be read as follows:

Function ShowGradientProperties(oSld as Slide)
  Dim counter as Integer
  With oSld.Background.Fill.GradientStops
    For counter = 1 to .Count
      Debug.Print counter, .Item(counter).Color
      Debug.Print counter, .Item(counter).Position
      Debug.Print counter, .Item(counter).Transparency
    Next
  End With
End Function

Open in new window


Now, when copying gradient properties, the gradient has to be added first using the GradientStops.Insert method. PowerPoint 2010 added a second Insert2 method which added the Brightness property for each gradient stop.

oSld.Background.Fill.GradientStops.Insert2 RGB, Position, [Transparency], [Index], [Brightness]

Open in new window


But, Brightness is not available in the slide's GradientStops object model so how is it possible to read the source gradient's Brightness?
0
Comment
Question by:Jamie Garroch
[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 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 40493596
Hi,

pls try

      Debug.Print counter, .Item(counter).Color.RGB
      Debug.Print counter, .Item(counter).Color.Brightness
      Debug.Print counter, .Item(counter).Position
      Debug.Print counter, .Item(counter).Transparency

Regards
0
 
LVL 12

Author Comment

by:Jamie Garroch
ID: 40493705
That works thank you Rgonzo1971. It's an odd place for the property but it's an odd property because if you set the color and then set the brightness, the color is changed! So, to copy a gradient stop, one first needs to set the brightness of the source stop to 0 before reading the color!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to edit animations within the presentation, incorporate sound, and set everything up with timing.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

722 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