Macro in slide master won't work

N

novice

I set up a macro for color scheme and test run it sucessfully.

Sub Color1()
'
' olive green color scheme
' Macro recorded 11/4/2006
'

ActiveWindow.Selection.Unselect
ActiveWindow.Selection.SlideRange.ColorScheme =
ActivePresentation.ColorSchemes(Index:=10)
End Sub

In the slide master I created a button > action settings > Run Macro in
Mouse Click tab.

The action button does not work in the Normal or Slide Show view of the
slide. What did I do wrong? Appreciate your help
 
J

John Wilson

Action buttons wont work in edit view
Any vba involving .selection wont work in slide show view (you cant select
in this view)

What are you trying to do?
--

Did that answer the question / help?
_____________________________
John Wilson
Microsoft Certified Office Specialist
http://www.technologytrish.co.uk/ppttipshome.html
 
G

Glen Millar

Hi,

Try this one:


If ActivePresentation.HasTitleMaster Then
ActivePresentation.TitleMaster.ColorScheme =
ActivePresentation.ColorSchemes(Index:=10)
End If
ActivePresentation.SlideMaster.ColorScheme =
ActivePresentation.ColorSchemes(Index:=10)
ActivePresentation.Slides.Range.ColorScheme =
ActivePresentation.SlideMaster.ColorScheme

--

Regards,

Glen Millar
Microsoft PPT MVP

Tutorials and PowerPoint animations at
www.pptworkbench.com

glen at pptworkbench dot com

Please tell us your PowerPoint / Windows version,
whether you are using vba, or
anything else relevant
 
N

novice

Hi Glen,

Thank you for your reply, however it is beyond my comprehension. I did
submit a reply yesterday but it is not posted. Therefore I 'm repeating my
plead for help once more.

I have very limited PP knowledge. Recently I took a PP 2003 online course,
using PP2002 without any VBA. I was following my course notes to learn how
to change color scheme for a presentation by creating a color-changing macro,
and then assign that macro to an action button.

I started with a new blank presentation > select an olive green color scheme
(color1) & close the task pane > record a new macro (color2) for a light
brown color scheme > change to the new color scheme & close the task pane >
click 'stop recording' on floating macro toolbar. Likewise I created a
Color1 Macro and test ran both macros. Both changed color scheme
successfully.

Then in master slide, I created 2 buttons and linked them to corresponding
macros, then tested them in slide show view. Both buttons did not change
color scheme. I don't understand why these successfully tested macros would
not work after they are linked. I describe my steps in detail and recopy
both macros below, hoping you could figure out my mistake.
----
Color1 Macro

Sub Color2()
'
' light brown color scheme
' Macro recorded 11/5/2006
'

ActiveWindow.Selection.SlideRange.ColorScheme =
ActivePresentation.ColorSchemes(Index:=12)
Application.CommandBars("Task Pane").Visible = False
End Sub
------------------------------------------------------------------------
Sub Color1()
'
' olive green
' Macro recorded 11/5/2006 by Sung
'

ActiveWindow.Selection.SlideRange.ColorScheme =
ActivePresentation.ColorSchemes(Index:=10)
Application.CommandBars("Task Pane").Visible = False
End Sub
-----

Color2 Macro

Sub Color2()
'
' light brown color scheme
' Macro recorded 11/5/2006 by Sung
'

ActiveWindow.Selection.SlideRange.ColorScheme =
ActivePresentation.ColorSchemes(Index:=12)
Application.CommandBars("Task Pane").Visible = False
End Sub
-------------------------------------------------------------
Sub Color1()
'
' olive green
' Macro recorded 11/5/2006 by Sung
'

ActiveWindow.Selection.SlideRange.ColorScheme =
ActivePresentation.ColorSchemes(Index:=10)
Application.CommandBars("Task Pane").Visible = False
End Sub
 
G

Glen Millar

Hi,

Sorry for the confusion. The macro you recorded was done in slide edit mode.
That means it is presuming there is an "active window" to work in, which
gets recorded in. However, when you switch to slideshow mode, it all falls
down because there is no active window to work in.

The code I pasted can be used to replace the code in your recorded macro. If
you paste it into your current macro, deleting all of the code except the
sub name and end sub at the end, it will do what you want in slideshow mode.

Note that if you paste it in and get a red coloured font, it means that line
wrap in the newsgroup has split a line and sent it to the next one. Else,
send me an email and I can send you a sample.

--

Regards,

Glen Millar
Microsoft PPT MVP

Tutorials and PowerPoint animations at
www.pptworkbench.com

glen at pptworkbench dot com

Please tell us your PowerPoint / Windows version,
whether you are using vba, or
anything else relevant
 
N

novice

Hi,

Thank you for your explanation. It prompted me to put down the course notes
and create both Macros and Action Buttons in Slide Master of the blank
presentation, then link them together. It works in the slide show. I then
decided to experiment your codes as followings

(1) In a new presentation, I created macros on the Slide Master of a design
template with a title master. Test run of macros (Tools > Macro > macros)
failed. Then I used your codes instead, it also did not work. Finally I
combined your codes with last line of my code, and the macros (Color3,
Color4) run successfully.

If ActivePresentation.HasTitleMaster Then
ActivePresentation.TitleMaster.ColorScheme =
ActivePresentation.ColorSchemes(Index:=1)
End If
ActivePresentation.SlideMaster.ColorScheme =
ActivePresentation.ColorSchemes(Index:=1)
ActivePresentation.Slides.Range.ColorScheme =
ActivePresentation.SlideMaster.ColorScheme
Application.CommandBars("Task Pane").Visible = False

I continued on to link these macros with action buttons on the Slide Master
and tested them in Slide Show view. These buttons do NOT work.

Where was my mistake?
Why would a design template be so different from a blank template?
How should I correct it?

(2) Open the original Blank presentation (A) that I had already
successfully linked action buttons to Color1 macro and Color2 macro. In
slide master view, I inserted the same slide master with title master (B)
with Color3 and Color4 macros. I selected Slide Master / Title Master (in
Color 3) to ran Color4 macro. Expecting both slide master and title master
of the design template (B) will change color, I was surprised that ONLY the
blank template (A) responded. These 2 sets of macros are in 2 different
modules in MS Visual Basic.

Why would template A react to a macro that was not created for it?
Why did template B not change color?
When 2 slide masters are in one presentation, does one have priority over
the other?
Did I insert a new slide master correctly? (Insert > New Slide Master >
select a design template (either by replace selected design / add design)

Your help will be very much appreciated.

Novice
 
G

Glen Millar

Novice,

Gosh. It is all getting complicated. One thing you can do is run your macro
hitting the <F8> key which will step through each line one by one. That way
you will know where it is all falling over. I'm flat out like a lizard
drinking and don't know that I can go through all of this stuff you have
posted.

--

Regards,

Glen Millar
Microsoft PPT MVP

Tutorials and PowerPoint animations at
www.pptworkbench.com

glen at pptworkbench dot com

Please tell us your PowerPoint / Windows version,
whether you are using vba, or
anything else relevant
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top