user2383049
user2383049

Reputation: 321

Button Disabling Itself - VBA

I am adding to another person's VBA code. A button they added has been working for the past 2 weeks, until today. I haven't touched the code for this button but now for some reason whenever I open the file, the button is disabled. I've looked through the code and haven't found anything that would disable the button. I've also gone directly to the button's properties and changed the Enabled property from False to True. When I change the property, the button is enabled as I save and close the file but when I reopen it, the button is disabled again. I guess what I am wondering is if there is a legitimate reason why this is happening and how to fix it.

Thanks for any help.

Upvotes: 0

Views: 174

Answers (2)

user2383049
user2383049

Reputation: 321

Ok, my problem actually had nothing to do with wrong code. I had named my file something that contained a key word that would disable the button if the file name contained this word. But that is the way of programming. One small thing can easily mess everything up!

Upvotes: 0

Refael
Refael

Reputation: 7323

You can set the button as Enabled by the code, like this:

 button1.Enabled=true

Apparently someone put it in the code somewhere.

You can search inside the code by ctrl+f, and remove the bad line...

Upvotes: 0

Related Questions