Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
01-23-2026, 07:37 AM
(This post was last modified: 01-23-2026, 03:23 PM by bplus.)
Quote:How many of you guys use this?
Why do you use it if you do?
#1 most prevelent and nasty bug that
you cant see is a typo, Option _Explicit prevents that.
So I use it when the code I wrote should work and it doesn't.
Udpdate: Option _Explicit helps find typos, I miswrote, it does not prevent typo's. My first step in tracking down bugs is this!
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 164
Threads: 54
Joined: Sep 2025
Reputation:
18
Well, thanks to Unseen for asking the question. I've seen it people's code and thought ("what's that doing there"). So, now I understand.
Posts: 316
Threads: 16
Joined: Apr 2022
Reputation:
43
I don't typically use it when doing little one off algorithms, but I've been warming up to OPTION _EXPLICIT more and more when writing big projects, where I really don't want to be dealing with typo errors in dozens of subroutines that are recycling local variables. It mostly catches when I do screw ups like using x and x% interchangeably. In fact, it's just about the first thing I will type in when starting a new large project. It's a lot easier to do it up front, and accept that discipline, than to add it later.
If I were to use any big variable names like SuperCalifragiVariable%, then I'd use it there as well. Those are the bugs that will drive you mad for hours without that tool.
I also find it helpful when I'm going back to clean up and optimize my algorithms. When I see a whole raft of DIMs at the head of a SUB or FUNCTION I start looking for ways to cut the number down while achieving the same results.
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Posts: 1,215
Threads: 162
Joined: Apr 2022
Reputation:
34
01-23-2026, 06:19 PM
(This post was last modified: 01-23-2026, 06:20 PM by madscijr.)
Between this thread, the discussion on WITH ... END WITH, and a few others where we debated different approaches or aspects of coding, it is evident to me that there is no "one size fits all" when it comes to programming practices. Everyone has their own take. So it can be nice to have options to do things in different ways. It can complicate things from a support standpoint or if someone else has to work with code done with a different style, and that's the trade-off. But I like these threads, it gives us a chance to debate and be exposed to different approaches and maybe learn something. Carry on!
Posts: 73
Threads: 12
Joined: Apr 2022
Reputation:
9
My biggest shortcoming with this subject is with plural string names, like:
TrackingNumber$ vs TrackingNumbers$
Sometimes I will type that name without the 's' when it belongs there. You stare at the code and just don't see it...