PC Review


Reply
Thread Tools Rate Thread

a color scheme won't apply (vba)

 
 
Pat Yearwood
Guest
Posts: n/a
 
      3rd Jul 2005
This seems really strange to me. Can someone shed some light on it?

The following macro changes my slide's color sheme. No big deal. I have 5
color schemes in the file. Any index number I put in the code works, EXCEPT
for #3. When set it as #3, it applies scheme #4. Again, all the other
numbers work, but #3. Nothing seems wrong with #3 color scheme itself. I use
it on many slides and can apply it manually just fine.

Here's what I'm using.

Sub ColSch3()
ActiveWindow.Selection.SlideRange.ColorScheme _
= ActivePresentation.ColorSchemes(Index:=3)
End Sub

Any thoughts on this?

TIA,
Pat




 
Reply With Quote
 
 
 
 
Steve Rindsberg
Guest
Posts: n/a
 
      3rd Jul 2005
> The following macro changes my slide's color sheme. No big deal. I have 5
> color schemes in the file. Any index number I put in the code works, EXCEPT
> for #3. When set it as #3, it applies scheme #4. Again, all the other
> numbers work, but #3. Nothing seems wrong with #3 color scheme itself. I use
> it on many slides and can apply it manually just fine.
>
> Here's what I'm using.
>
> Sub ColSch3()
> ActiveWindow.Selection.SlideRange.ColorScheme _
> = ActivePresentation.ColorSchemes(Index:=3)
> End Sub
>


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 Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


 
Reply With Quote
 
Pat Yearwood
Guest
Posts: n/a
 
      3rd Jul 2005
"Steve Rindsberg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>> The following macro changes my slide's color sheme. No big deal. I have 5
>> color schemes in the file. Any index number I put in the code works,
>> EXCEPT
>> for #3. When set it as #3, it applies scheme #4. Again, all the other
>> numbers work, but #3. Nothing seems wrong with #3 color scheme itself. I
>> use
>> it on many slides and can apply it manually just fine.
>>
>> Here's what I'm using.
>>
>> Sub ColSch3()
>> ActiveWindow.Selection.SlideRange.ColorScheme _
>> = ActivePresentation.ColorSchemes(Index:=3)
>> End Sub


> 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.



 
Reply With Quote
 
Pat Yearwood
Guest
Posts: n/a
 
      3rd Jul 2005
"Steve Rindsberg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>> The following macro changes my slide's color sheme. No big deal. I have 5
>> color schemes in the file. Any index number I put in the code works,
>> EXCEPT
>> for #3. When set it as #3, it applies scheme #4. Again, all the other
>> numbers work, but #3. Nothing seems wrong with #3 color scheme itself. I
>> use
>> it on many slides and can apply it manually just fine.
>>
>> Here's what I'm using.
>>
>> Sub ColSch3()
>> ActiveWindow.Selection.SlideRange.ColorScheme _
>> = ActivePresentation.ColorSchemes(Index:=3)
>> End Sub
>>

>
> 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:


Hold the phone!

In looking at the master slide view, I now see my multiple masters can
independantly house a unique set of color schemes. So, what is scheme #3 in
one master may not be #3 in another. Although one master only has 2 schemes,
your macro applies the numbered schemes from a some sort of "total" list of
schemes.

I haven't figure this out yet, but this shows me the plot has thickened.


 
Reply With Quote
 
Pat Yearwood
Guest
Posts: n/a
 
      3rd Jul 2005
"Steve Rindsberg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>> The following macro changes my slide's color sheme. No big deal. I have 5
>> color schemes in the file. Any index number I put in the code works,
>> EXCEPT
>> for #3. When set it as #3, it applies scheme #4. Again, all the other
>> numbers work, but #3. Nothing seems wrong with #3 color scheme itself. I
>> use
>> it on many slides and can apply it manually just fine.
>>
>> Here's what I'm using.
>>
>> Sub ColSch3()
>> ActiveWindow.Selection.SlideRange.ColorScheme _
>> = ActivePresentation.ColorSchemes(Index:=3)
>> End Sub
>>

>
> 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:


Ok, in a test version of my file, I basically rebuilt all my schemes from
inside the slide master view, not from normal view. I deleted any unique
schemes a master had different from the others. So all my masters now have
exactly the same choice of schemes.

Now, all the code, including yours, works correctly. Lesson learned (I
think). If I plan to apply color schemes via code from one slide to another
that may involve differing master slides, all my masters have to have the
exact same set of color schemes. That's what it seems to me, anyway.



 
Reply With Quote
 
Steve Rindsberg
Guest
Posts: n/a
 
      4th Jul 2005

> Ok, in a test version of my file, I basically rebuilt all my schemes from
> inside the slide master view, not from normal view. I deleted any unique
> schemes a master had different from the others. So all my masters now have
> exactly the same choice of schemes.
>
> Now, all the code, including yours, works correctly. Lesson learned (I
> think). If I plan to apply color schemes via code from one slide to another
> that may involve differing master slides, all my masters have to have the
> exact same set of color schemes. That's what it seems to me, anyway.


Excellent. I was going to suggest looking into this next, but ya beat me
there. I suspect it'd be fairly simple to dupe the schemes from one master to
the others (in code, though a real nuisance manually).


-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


 
Reply With Quote
 
clydebrown@...
Guest
Posts: n/a
 
      4th Jul 2005
"Steve Rindsberg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
>> Ok, in a test version of my file, I basically rebuilt all my schemes from
>> inside the slide master view, not from normal view. I deleted any unique
>> schemes a master had different from the others. So all my masters now
>> have
>> exactly the same choice of schemes.
>>
>> Now, all the code, including yours, works correctly. Lesson learned (I
>> think). If I plan to apply color schemes via code from one slide to
>> another
>> that may involve differing master slides, all my masters have to have the
>> exact same set of color schemes. That's what it seems to me, anyway.

>
> Excellent. I was going to suggest looking into this next, but ya beat me
> there. I suspect it'd be fairly simple to dupe the schemes from one
> master to
> the others (in code, though a real nuisance manually).


The time it would take ME to figure out code to dupe the schemes, I would
have already had it done manually. <lmao>

So, I manaully deleted all but one scheme from each master, rebuilt the
schemes I needed, and then deleted the first scheme.

Adding the schemes was not bad because to add a scheme to one master
automatically added it to all masters. However, removing them had to be done
individually from each master. Not fun, but I just got quick on the
accelerator keys and got through it.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apply extra theme color scheme using VBA (PP2007) Luca Brasi Microsoft Powerpoint 0 16th Oct 2008 07:43 AM
Apply Office 2003 color scheme to Office XP 2002 titus12 Windows XP Help 0 23rd May 2008 10:21 AM
Color Scheme: Color Tweaking? (Word 07) =?Utf-8?B?RGF2YWNr?= Microsoft Word Document Management 3 22nd Jul 2007 12:30 AM
How do I apply color in cells ..color now shown only in print prev =?Utf-8?B?Ym9uYWRpbWk=?= Microsoft Excel Worksheet Functions 1 25th Apr 2006 07:34 PM
whether IE support system color in high contrast color scheme nlp Windows XP Internet Explorer 0 23rd Sep 2004 04:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:19 PM.