This slight mod works here and if you run it from Normal view rather than
from
w/in the IDE, you can watch what happens at each step. Start there and
let us
know what you discover:
Sub DudeColors()
Dim x As Long
For x = 1 To ActivePresentation.ColorSchemes.Count
MsgBox "About to apply scheme: " & CStr(x)
ActiveWindow.Selection.SlideRange.ColorScheme _
= ActivePresentation.ColorSchemes(Index:=x)
Next ' color scheme
End Sub
Steve, thank you for helping on this. Either I have a corrupt color scheme
mechanism or PowerPoint's scheme numbering system is not as intuitive as it
seems. I would think a scheme's number is what it appears to be by counting
the schemes in the scheme task pane. But my file is not doing that.
I tried replicating this problem in a new file and cannot do it. Maybe,
however, it's because my file is more complicated with many multiple masters
and such. In a new file, the scheme numbering system seems to work right.
In my file, upon the macro applying scheme #3, it applies #4. (I think #4
was edited from #3 at one time.) With the schemes task pane open, I can
clearly see #4 became selected instead of #3. It applies #1 & 2 correctley,
screws up #3, then gets it right again with #4 and on.
To see what would happen, I added more color schemes and reran the macro.
Still, when it came to #3, it got it wrong. In fact, it applied #7 instead
of #3 now. It's difficult for me to peg a trend going on here.
I noticed another oddity while doing this. I deleted schemes 6-8, resaved,
and restarted the file, only to find the macro still applies schemes 6-8.
How is that possible when they no longer exist? In a new file, when I
deleted the schemes, they never would be applied again. What could be
different about my file?
I saved the file as another version, and deleted scheme #3 and it still had
numbering messed up and still applied all the schemes that no longer
existed. I then deleted all but one scheme and it still applied all the
deleted schemes. I then added a second scheme and the macro still did not
see that as the #2 scheme - it saw it as 3 or 4.
Coincidently, I have to rebuild these schemes anyway because our approved
colors changed yesterday, but I can see now this will be a problem. When I
delete the old schemes, the numbering system will be screwed up and deleted
schemes will somehow still exist in a way. The deal is, I have to be able to
apply a scheme through code, but now I don't know how I'll do that when
numbers won't match up to the actual schemes that exist. Grrrrr.
I guess I'll just have to rig it to work. I'll first change the schemes to
the new colors and then see how PowerPoint reacts to numbers I choose to
apply. I'll figure out the pattern it's using and adapt to it. I'll just add
lots of comments in the code to explain the strange numbering system. I
don't know. I'll figure something out, though.
Anyway, if you have any other ideas, I'm all ears. Thanx.