By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,452 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

How Do You Link Keys To Cursor In PPT VBA ?

P: 1
Hello
in powerpoint, can you link keys on the keyboard so that when you press a certain key, the cursor automaticaly clicks a certain area on the screen?
help or examples greatly appreciated
Jan 21 '08 #1
Share this Question
Share on Google+
1 Reply


kadghar
Expert 100+
P: 1,295
Hello
in powerpoint, can you link keys on the keyboard so that when you press a certain key, the cursor automaticaly clicks a certain area on the screen?
help or examples greatly appreciated

I don't know if Slides have events such as KeyPress, but i think we can use an 'alternative' to this. An alternative i tried before was adding a transparent command button with no text in each slide. It was suposed to be selected all the time, and it was going to have some code in its KeyPress event. This didnt work. =(

What i did was to put a transparent VB TextBox in each slide (note that there's a difference between the shapes you put with PPT and the VB controls you can add using the controls menu) and use its Change event.

Please, also note it must be visible or you wont be able to use it. Just make it small and colorless so nobody will notice it, and keep it always selected.

Now, the other problem we have is that you can select and change any shape or text in the slide, but if it has an hyperlink, i dont know if its possible to click on them with code, unles they are VB controls, instead of shapes.

In case they are PPT shapes i'd re-write the same thing they do all over again with code, instead of attemping to click on it (this will require to move the mouse to the coordenates), in case it's a VB control, well just call the Sub of the event.

Just to give a little example, if you want that when you press "k" you go to the next slide, when you press "q" you stop the presentation, and when you press "t" an explorer its opened in this page, just write something like this in the Change event of the "invisible" textbox:

Expand|Select|Wrap|Line Numbers
  1. Private Sub TextBox1_Change()
  2. Select Case LCase(TextBox1.Text)
  3.     Case "k": SlideShowWindows(Index:=1).View.Next
  4.     Case "q": SlideShowWindows(Index:=1).View.Exit
  5.     Case "t"
  6.         Dim obj1 As Object
  7.         Set obj1 = CreateObject("internetexplorer.application")
  8.         obj1.Visible = True
  9.         obj1.navigate "http://www.thescripts.com"
  10. End Select
  11. TextBox1.Text = ""
  12. End Sub
Anyway, i'll keep subscribed here, in case someone else knows a better solution.
Jan 22 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.