Partilhar via


Experienced Challenge 9: And They're Off!

Office Programs Required

Microsoft PowerPoint 2007

Goldfish Awarded

10

Deadline for Submission

Friday, May 1, 2009 (8:00 AM Pacific Daylight Time)

Files Required

Experienced_challenge_9.pptm in the OfficePalooza Challenge Pack.

Here’s a question for you: could there possibly be anything more fun than a horse race conducted in Microsoft PowerPoint? After all – what’s that? Well, OK, we have to admit that does sound like it would be a lot more fun than a horse race conducted in Microsoft PowerPoint. And, well, yeah, so does that. And that. And – well, never mind; we get the idea.

OK, so maybe Challenge 9 isn’t the most exciting thing in the world; however, it is the most exciting event in this year’s OfficePalooza. (No, don’t start that again; let’s just pretend it’s the most exciting event.) To complete the challenge for And They’re Off! , you’ll need to open the file Experienced_challenge_9.pptm, found in the OfficePalooza Challenge Pack . Experienced_challenge_9.pptm is a one-slide PowerPoint presentation that looks like this:

Experienced Challenge 9

See those four little race horses? Your task is to write a Visual Basic for Applications subroutine that will cause those four horses to race across the screen, with the winner being the first horse to cross the finish line. (You know, just like a real horse race.) Oh, and there’s a catch here: each horse should have an equal chance of winning. Couldn’t you just add a couple of PowerPoint animations that would look like a race, but would result in, say, the green horse winning every time? Yes, you could. But of you do, you won’t earn any goldfish for this challenge.

To complete Challenge 9, right-click the Start Race button and then click View Code. That will open up the Visual Basic Editor, along with the following subroutine:

Private Sub CommandButton2_Click()

End Sub

Note. When the Visual Basic Editor opens up, you’ll also see a subroutine named CommandButton1_Click() . This subroutine is tied to the New Race button, and is designed to correctly position the four race horses at the start of each race. The code here should also give you a hint or two (or four) as to how you can refer to each of the four horses.

All you have to do is enter the code as part of the CommandButton2_Click() subroutine for conducting the horse race. (Note that all the code must be included in this subroutine; this is due to the way we have to test this code.)

You know what? We still think this is the most exciting thing in the world.

But, then again, we don’t get out much.

Submitting Your Entry

The OfficePalooza sweepstakes is over, but you’re welcome to try the challenges and learn on your own. Good luck!