Solved

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

Posted on 2014-12-11
2
254 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 51

Accepted Solution

by:
Rgonzo1971 earned 500 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 11

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Suggested Solutions

Title # Comments Views Activity
checkbox to hide entire section 10 76
Access2016 ignore hyphen in data entry or searches 5 70
Excel VBA API Loop Query Return results in excel 4 60
WMIC Output Formatting 1 84
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…
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 video teaches viewers how to create handouts from their slides and helps them decide how many slides to include per handout.
The viewer will learn how to edit animations within the presentation, incorporate sound, and set everything up with timing.

734 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