Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show letters/objects based on Keypress in Powerpoint

Status
Not open for further replies.

ano1

MIS
Mar 5, 2006
3
US
Hello All,

I need some assistance with VBA in PowerPoint. My slide is set up as follows: I have combinations of letters (some letters more than once) on each slide. Each letter is in a separate textbox and is hidden from initial view by covering it with a filled rectangle.

What I want is for the boxes covering each letter to be triggered to exit (disappear) when the letter it covers is pressed on the keyboard. Basically if I press the ‘A’ key I want all the A(s) on the screen to appear. Also if the letter is non-existent I would like a sound to play. Can anyone help me figure out the code to do this?

If I need to change the way the slide is laid out (form elements instead of textboxes etc.) in order to get this to work, I am willing to do so. Your help and time is greatly appreciated.
 
just guessing but you might need to use a form and use the KeyPress event
 
Create a textbox that covers your entire slide, set the line and background to transparent, then use the Keyevent of the textbox to trap the keys being pressed.


Chance,

Filmmaker, taken gentleman and He tan e epi tas
 
Thanks for the advice. As you suggested I have created a textbox that covers your entire slide.

I am having trouble with the keypress event. What I am doing is a game board similar to wheel of fortune. Basically when I type a letter, say 'A' into the text box, I want all the letter A(s) (assuming there is one on the slide) to appear on the screen. What I think I need is a loop that checks other text boxes for the letter pressed and then highlights that textbox.

Correct me if I am incorrectly working this out in my head, but I need a snippet of code that searches all text boxes for the imputed letter and then changes that letter to a new font color.

Thanks in advance for your help.

 
A Array approach may be better,


Dim arr_answers() as variant

arr_answers("A","Textbox1","Textbox5")

Where A is in textbox1 and textbox 5, then you could loop through the array and decide the control to change.



Chance,

Filmmaker, taken gentleman and He tan e epi tas
 
Thanks for the idea. I was hoping to not have to hardcode the answer indo my VBA. I want to be able to write the letters on my slide and have the VBA automatically work no matter what letters I choose. Any suggestions?

Also how would I use your idea if I decide to go that route? I am new to Arrays. Could someone show a simple example using the above code that would loop though that one array and then change the font color Textbox1 and Textbox5?

Thanks again to everyone for their advice.

 
The VBA help is pretty good on arrays,

Chance,

Filmmaker, taken gentleman and He tan e epi tas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top