Control Array in PowerPoint VB

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?
 
J

John Wilson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top