Control Array in PowerPoint VB

  • Thread starter Thread starter JTW
  • Start date Start date
J

JTW

How can you determine which control was activated (through an attached
"action") to invoke a macro in Visual Basic (i.e. which was the last object
clicked on).
I have several similar named buttons on a slide with attached actions for
mouse clicks. Currently i have a separate macro for each. Each button
executes the SAME code with one exception....that each sets a common variable
to a different value

eg.
Dim buttonpress as integer
Sub button1
buttonpress = 1 (or 2 or 3 etc)
...common code here...
End sub

of course this works....but doesn't seem like the most elegant solution. I
would like to consolidate this code and determine which button was pressed to
initiate the macro.
ideas?
 
Maybe something like this

Sub butt_press(oshp As Shape)
'oshp is reference to clicked shape
'set var depending on oshp
'rest of code
End Sub

All the buttons run the same code
 
Back
Top