PPT game with VBA programming. Need help!

J

Jo Rist

I work with Win XP and PPT 2003. I would like to provide
an interactive country puzzle. I have map of Europe with
all Nations in PPT on a foil as individual objects.
Beside the map the names of all countries of Europe are
particular listed. Now the country names are to be
assigned to the land objects as follows: Mouse-click on
country name and afterwards mouse-click on the correct
(!) country opens a new foil. In the case of wrong
allocation a short message or a sound object has to
appear. By trigger function I can assign the correct
country names to an object, but I cannot query a second
event (mouse-click), before an appropriate reaction
follows. Obviously something additionally must be
programmed here. But I can't do any VBA programming. Who
can help me?
 
D

David M. Marcovitz

Take a deep breath. Getting started with VBA isn't the easiest thing,
but it can do exactly what you want. You might want to check out the
Programming PowerPoint section of the PPT FAQ:

http://www.rdpslides.com/pptfaq/#PROGRAMMING_POWERPOINT

Here is some simple code that will do basically what you want. It
probably needs some tweaking to do exactly what you want. There are many
other ways to do this, so you might find a better way. I have a just put
two "countries" in this example. If you had objects for France and
Germany, you could assign each of them the macros FranceSelect and
GermanySelect respectively. Then you have the names "France" and
"Germany" written separately. You can assign the text for France and
Germany to the macros FranceName and GermanyName respectively. Finally,
in case someone clicks on the wrong country, you could have a shape in
the background (use Draw > Send to Back) that is assigned to the macro
ClearSelection. If the user clicks on the France shape and then clicks
on the word France, it will jump to slide 3 (you can set this number to
anything you want). The same goes for Germany. If the user clicks on
the France shape and the word Germany, it will put up a message that says
Try Again.

This is very rough and would need some feedback to let the user know what
was selected, but it should give you the basic idea of what is possible.

--David

Dim selected

Sub FranceSelect()
selected = "France"
End Sub
Sub GermanySelect()
selected = "Germany"
End Sub
Sub ClearSelection()
selected = ""
End Sub
Sub FranceName()
If selected = "" Then
MsgBox ("You must have a country selected before clicking on a
name.")
ElseIf selected = "France" Then
ActivePresentation.SlideShowWindow.View.GotoSlide (3)
Else
selected = ""
MsgBox ("Try again")
End If
End Sub
Sub GermanyName()
If selected = "" Then
MsgBox ("You must have a country selected before clicking on a
name.")
ElseIf selected = "Germany" Then
ActivePresentation.SlideShowWindow.View.GotoSlide (3)
Else
selected = ""
MsgBox ("Try again")
End If
End Sub


--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
U

Ute Simon

Jo Rist said:
I work with Win XP and PPT 2003. I would like to provide
an interactive country puzzle. I have map of Europe with
all Nations in PPT on a foil as individual objects.
Beside the map the names of all countries of Europe are
particular listed. Now the country names are to be
assigned to the land objects as follows: Mouse-click on
country name and afterwards mouse-click on the correct
(!) country opens a new foil. In the case of wrong
allocation a short message or a sound object has to
appear. By trigger function I can assign the correct
country names to an object, but I cannot query a second
event (mouse-click), before an appropriate reaction
follows. Obviously something additionally must be
programmed here. But I can't do any VBA programming. Who
can help me?

Hi Jo,

there might be a way without VBA: Copy your map and place it on top of the
first one. The country objects of the bottom layer trigger sound objects or
message boxes telling the user that he selected the wrong one. Put
hyperlinks to the new slides on the copied map objects in the top layer.
Make the country copies appear by using a trigger animation when clicked on
the country name. If you arrange the copies very precisely, no one will
notice, that the copy appeared.

If someone now clicks e.g. on the country name "France", the map object
"France" appears. But if he clicks on the "Spain" map object with the second
click, the "that's-wrong-sound" is triggered, if he clicks on France, the
hyperlink takes him to the next slide.

This sounds a bit tricky, but should be easy to realise without VBA. If you
prefer an explanation in German (I'm from Germany, too), or would like to
see a sample file, change the country code "ed" in my reply mail address to
"de" and send me an e-mail. You're also welcome to the German PowerPoint
newsgroup if you like.

Kind regards,
Ute
 

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