Macro (?) to change greeting.

R

Robert

I don't know if this is possible, but it would be useful. I want to modify a
title slide to show either "Good Morning", "Good Afternoon" or "Good Evening"
to the user according to the time of day. A macro might be the answer. But
then, how could it be called automatically each time the presentation is run?
The teacher will usually be absent.
 
A

Austin Myers

It can be done with a bit of VBA code, but that will introduce another issue
in that when played on another machine they will get a warning about the
possible danger of your add in. Is it worth it?


Austin Myers
MS PowerPoint MVP Team

Solutions to Multimedia in PowerPoint www.pfcmedia.com
 
R

Robert

Yes, it would certainly be worth it since I only have access to one machine
for both preparation and presentation. I would be most grateful for your
"bit of VBA code" plus an indication of how to "call" it. By the way I have
PPT 2002 on WinXP. Thank you for your reply.

Austin Myers said:
It can be done with a bit of VBA code, but that will introduce another issue
in that when played on another machine they will get a warning about the
possible danger of your add in. Is it worth it?


Austin Myers
MS PowerPoint MVP Team

Solutions to Multimedia in PowerPoint www.pfcmedia.com
 
A

Austin Myers

A very simple demonstration might look like this.

In VBA create a new module and then paste this code in it.

Sub Auto_Open()
myString = Time
If myString < "12:00" Then
MsgBox "Good Morning"
End If
If Time > "12:00" Then
MsgBox "Good Afternoon"
End If
End Sub

Obviously you could use your own form instead of a message box. You may
change the time you want to use to trigger the different message or even add
more break points.

The key here is to name the sub "Auto_Open" so it fires when you start PPT.


Austin Myers
MS PowerPoint MVP Team

Solutions to Multimedia in PowerPoint www.pfcmedia.com


Robert said:
Yes, it would certainly be worth it since I only have access to one machine
for both preparation and presentation. I would be most grateful for your
"bit of VBA code" plus an indication of how to "call" it. By the way I have
PPT 2002 on WinXP. Thank you for your reply.
 
R

Robert

Thank you Austin; that looks interesting. I'll play around with it a little.
I would rather like the words "morning", "afternoon", "evening" to appear as
part of the title slide itself, with the same formatting. (I don't know what
the VBA command would be to print directly on the slide.) Another idea to
explore with you, if I may, is to (a) leave a gap for the missing word
(above) in the title slide; (b) create three parallel title slides each
containing just the one missing word, and (c) to call only the required slide
so as to superimpose (how?) the word over the rest of the main title slide.
Is any of this even remotely possible?
 
A

Austin Myers

Yes, you could put it on the slide, but then your users will have to delete
the text everytime they want to build a presentation.


Austin Myers
MS PowerPoint MVP Team

Solutions to Multimedia in PowerPoint www.pfcmedia.com
 
R

Robert

But that is not my situation. I am the one who will build all the
presentations; my users will use them for one-to-one instruction in my
absence. Please tell me how to put the required information on the title
slide; alternatively, how to create a small, one-slide presentation which
could be appended to the "front end" of any instruction sequence. Or is it
all just too difficult?
 
D

David M. Marcovitz

If Austin's code works for you, then you have solved the hard part. Anything
else you want to do is easy. You could, for example, replace MsgBox "Good
Morning" with

ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text = "Good
Morning"

to put the text in the title area of the first slide.

--David

David Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
H

Hans W. Hofmann

On Sat, 30 Apr 2005 13:56:02 -0700, Robert

I Hope this code will be usefull

Sub OnSlideShowPageChange(sl As SlideShowWindow)
Dim sh As Shape, i As Integer, GreetingTime As Integer
Dim Greetings
'Only for first Slide in Show
If sl.View.CurrentShowPosition = 1 Then
GreetingTime = (Time * 24) \ 6
Greetings = Array("Good Night", "Good Morning", "Good Afternoon",
"Good Evening")
For Each sh In sl.View.Slide.Shapes
If sh.HasTextFrame Then
For i = 0 To 3
If InStr(sh.TextFrame.TextRange.Text, Greetings(i))
Then
sh.TextFrame.TextRange.Text = _
Replace(sh.TextFrame.TextRange.Text, Greetings(i),
Greetings(GreetingTime))
Exit For
End If
Next
End If
Next
End If
End Sub
 
R

Robert

Heartfelt thanks to the three distinguished contributors to this thread:
Austin Myers, David Marcovitz and Hans W. Hofman. I now have quite a lot of
work to do but I can see the way ahead.

Herzlichen Dank besonders zu Dir Hans; das ist ja ausgezeichnet gut.
 

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