PDA

View Full Version : To Click or Ctrl + Click?



TrippyTom
12-11-2007, 11:12 AM
Hey people,

I guess this is a general question, but I put it in the PPT section because that's what I want to apply the answer to (in my case).

Is there a way to set different code to run depending if the user Clicks or (Ctrl + Clicks) or (Shift + Clicks) a macro button?

Paul_Hossler
12-11-2007, 05:20 PM
Try this in slide show mode and click the [i] button with various combanations of shifts

Paul

TrippyTom
12-11-2007, 05:31 PM
Thanks Paul,

I should have been more clear. I want to apply this test to a macro button on a toolbar I created via code. Can I apply the same kind of logic to something like that?

I looked at that code and it almost made my brain explode. :think:

Paul_Hossler
12-12-2007, 10:29 AM
Well .....

This is some code I use to determine is the Shift key was down when I click a control / command button. Maybe you could adopt it to fit your needs.

It still uses the IsShiftKeyDown () sub from the PPT file, and returns the Control (object), the control's caption, and a boolean if the shift was down when clicked

One thing -- if you have command bar with a menu and you click on a control on that menu, you need to have the shift down when you click on the command bar's menu. Not sure why, but also never bothered to investigate.



Sub ButtonClicked(ByRef ctlClicked As CommandBarControl, _
ByRef sCaption As String, _
ByRef bShifted As Boolean)
Set ctlClicked = Application.CommandBars.ActionControl
If ctlClicked Is Nothing Then
sCaption = ""
bShifted = False
Else
sCaption = ctlClicked.Caption
bShifted = IsShiftKeyDown
End If
End Sub

TrippyTom
12-13-2007, 09:21 AM
Thanks Paul! :)

I'm sure this will help. I'm excited to try it out. :thumb

Paul_Hossler
12-13-2007, 09:36 PM
Let me know how it worked

Paul