0

Here is my code I tried but it has failed

Sub TurnOffViewCode()
   Application.CommandBars("Code").Enabled = False

End Sub
braX
  • 11,506
  • 5
  • 20
  • 33
  • 2
    Why don't you just protect your code instead? – Rory Jan 30 '23 at 10:39
  • How can I do that using a macro – Intel Power Jan 30 '23 at 10:47
  • 3
    Trying to disable viewing code trough VBA is useless because if user deactivates all macros it does nothing. Check [Password protect your VBA project](https://www.microsoft.com/en-us/microsoft-365/blog/2010/06/28/power-tip-password-protect-your-vba-project/) – Foxfire And Burns And Burns Jan 30 '23 at 11:34
  • Do note that password protecting your vba code is only to keep it safe from dummies, if there's ill intent, they can still get in, see: https://stackoverflow.com/questions/1026483/is-there-a-way-to-crack-the-password-on-an-excel-vba-project – Notus_Panda Jan 30 '23 at 12:42

0 Answers0