Disable button(shape) after click

P

Preschool Mike

Does anyone know of any vba to disable a button (e.g., shape that runs a
macro) after it has been clicked. The button (shape) runs a macro that
counts and I want to prevent the user from accidently clicking twice.
 
J

John Wilson

Easiest way is to make a second copy of the button with no action
Put this behind the proper button and give the top button a trigger
animation of disappear (triggered by a click on itself) When you click the
macro will run first then the real button will disappear leaving the inactive
blank.

Don't try to use a macro to set visible to false because this will not reset
next time the presentation runs.
 
M

Mark

Does anyone know of any vba to disable a button (e.g., shape that runs a
macro) after it has been clicked.  The button (shape) runs a macro that
counts and I want to prevent the user from accidently clicking twice.

You can set the action for the button to ppActionNone:

With
Application.ActivePresentation.Slides(1).Shapes("SetupButton").ActionSettings(ppMouseClick)
.Action = ppActionNone
End With
 
P

Preschool Mike

Very clever, work nicely. Out of curiosity wouldn't creating a macro to set
visible to true at the beginning of the presentation reset it correctly? Or
not?
 
M

Mark

What would I use to reset it the next time?
--
Mike Mast
Special Education Preschool Teacher







- Show quoted text -

Each time the presentation is opened, it will reset the codeRun
variable to 'False' (default value for boolean variables). So,
whenever you open the presentation, it will allow the code to run only
1 time (unless you reset the variable yourself, e.g. "codeRun = False")
 
D

David Marcovitz

I think it will work to reset the button if you put the same code in
your Initialize procedure but change the .Action line to:

..Action = ppActionRunMacro

--David

What would I use to reset it the next time?


--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
 

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