For a PowerPoint 2010 add-in for our corporate template, I've got a macro button that lets them select an image from the corporate library and insert that as the slide background. I want to take that one step further and, if they select a specific layout, convert that background image to grayscale. This is easy to do manually (right-click, format background, picture color, recolor, greyscale), but I need to do it with VBA. Here is what I've tried:
Set fd = Application.FileDialog(msoFileDialogFilePicker)
fd.Title = "Select Background Image"
fd.InitialFileName = contentlibraryfolder & "\Background Images"
If .Show = -1 Then
pickedpix = .SelectedItems(1)
Set fd = Nothing
currentslide.FollowMasterBackground = False
If InStr(currentslide.CustomLayout.Name, "B&W") Then
currentslide.Background.Fill.PictureEffects.Insert(msoEffectSaturation).EffectParameters(1).Value = 0
This works great up to "currentslide.Background.F
cture (pickedpix)." But that last line fails to turn the picture to grayscale. But it doesn't give me an error either. I know I'm very close because this same pictureeffects method will turn a regular picture on the foreground of the slide to grayscale, but it's not changing the background.
I'm presenting this in 9 hours at a corporate meeting and would love to include this feature if someone can point me in the right direction.