Home > Articles

  • Print
  • + Share This
Like this article? We recommend

Whew! If you've never written code, this looks like a bunch of gibberish. And if you're a professional developer (which I am clearly not), you'll see this as a kludge of code cut-and-pasted together from a variety of sources. What's cool is that a neophyte programmer like me, with barely any experience, can actually create a program that will accomplish this task.

Essentially, in the Access macro:

  1. I determine who's the winner—who received a score of 3 (gold), 2 (silver), and 1 (bronze)—from the me.value properties in the Access UserForm.

  2. Then, through a rather cumbersome process, I determine what those numbers "mean;" that is, which team actually is in first, second, and third place. (The teams are represented by the string variables A, B, C, and D, which lets me change the team names in the PowerPoint slide without affecting the underlying code.)

  3. When the winners are determined, all that's left is to decide which PowerPoint slide to display in the file, Automation.ppt.

TIP

While Office automation will even let you create an entirely new PowerPoint file from scratch, I feel safer using one that I already have and know where it's stored.

How did I patch together the PowerPoint code to display the proper slide full screen? Essentially, by using the macro recorder and other slivers of code that I found on the Microsoft Developer Network (MSDN) Web site, and in some textbooks from Que and Sams.

NOTE

I mentioned before that I'm not a programmer. If you are, you'll probably want to insert some real error-handling code, where you see the boldface reminder.

The key point to remember is that you're controlling PowerPoint from Access. Your variables gather information from the form fields and calculate the results; then Access opens an instance of PowerPoint and the correct file, and selects a particular slide (by its index number) to display full screen.

All the animation and effects are pre-scripted in the PowerPoint slide, to let the winners appear on the podium last. Finally, a sound file plays "The Star Spangled Banner," just as in a real Olympic medal ceremony!

  • + Share This
  • 🔖 Save To Your Account