Solved

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

Posted on 2014-12-11
2
230 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
2 Comments
 
LVL 48

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 9

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

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

 Regular Expressions Microsoft Word has sophisticated search tools that can search for patterns. For example if you wanted to search for all UK phone numbers that followed a pattern of five digits, a space and then six digits you can easily do th…
Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
This video teaches viewers how to create handouts from their slides and helps them decide how many slides to include per handout.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 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