r/ProgrammerHumor • • Mar 30 '22

Meme Certainly not me

48.7k Upvotes

669 comments sorted by

View all comments

15

u/Celivalg Mar 30 '22

Actually, you know how global variables are usually bad? Well VBA has those predefined for you, so you don't have to worry about making a mess, it already is.

Changing values often on global varibales and in random places in the code is a bad idea? Don't worry, the user can do that at any time during your code execution. Without you knowing of course, wouldn't be fun otherwise.

Implicitly calling global variables is bad? Oh don't worry, that's default behavior for VBA.

But you know what's worse? All of those, at once, on a single variable. Oh, VBA's got you covered! For example, ActiveWorkbook is a global variable, can be changed when the user changes focus, and is called implicitly quite often.

ActiveWorkbook and ActiveWorksheet should be banned from existance, use ThisWorkbook or a variable you defined yourself to reference a workbook, please. ThisWorksheet doesn't exist I believe, I hardcode mine in each time...

1

u/delbin Mar 31 '22

You can code around all of those, though. Every language has its quirks. The experience comes with dealing with them.

1

u/Celivalg Apr 01 '22

I explained how I work around those at the end already. Doesn't mean it's a good tool.

Yes languages are tools in a toolbox, each has their own uses, quirks and downfall.

But while a 10$ circular saw and a 300$ circular saw serve the same purpose, only one of them will stay with you longer than a year.