Can I disable macro in worksheet events?
Can I disable macro in worksheet events?
T-ogether
E-veryone
A-chieves
M-ore
One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.
?
[vba]
Private Sub Worksheet_Deactivate()
ActiveWorkbook.RunAutoMacros (xlAutoOpen)
End Sub
Private Sub Worksheet_Activate()
ActiveWorkbook.RunAutoMacros (xlAutoClose)
End Sub
[/vba]
T-ogether
E-veryone
A-chieves
M-ore
One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.
What is the question regarding post #2?
I just tried to enter the code like that and it seems it doesnt work at all...
T-ogether
E-veryone
A-chieves
M-ore
One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.
Then I am confused. You ask about disabling macros, then show code to run macros.
What exactly are you trying to do?
I want to Disable Macros in a worksheet event if its possible?
T-ogether
E-veryone
A-chieves
M-ore
One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.
If you want to disable all macros in someone else's workbook, you have to open it with macros disabled. If you want to stop macros running from within your workbook, you will need to stop them manually, with some sort of flag setting. If you just don't want users to run macros from Excel, add Option Private Module at the start of the modules.
To disable event code use Application.EnableEvents = False (and don't forget to set it back to True later)
You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you
The major part of getting the right answer lies in asking the right question...
Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.
I've got full of option,information,idea to take. Thanks people...
T-ogether
E-veryone
A-chieves
M-ore
One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.