Disable one Macro with another Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to disable a macro and prevent it from running with a command
from another macro?
 
One way to do that is with a flag variable:

Dim DisableFlag As Boolean

Sub DisableTheMacro()
DisableFlag = True
End Sub

Sub EnableTheMacro()
DisableFlag = False
End Sub

Sub TheMacro()
If Not DisableFlag Then
MsgBox "The Macro has Run!"
End If
End Sub


--
Jim Rech
Excel MVP
| Is it possible to disable a macro and prevent it from running with a
command
| from another macro?
| --
| Andy T
 

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

Back
Top