![]() If a "self-contained" subroutine or function has been debugged, it will save debugging time when you reuse it in another script. Modularize your scripts with functions and subroutinesĪny block of code that will be used more than once can be moved into a subroutine or function.ĭividing the code into logical subroutines and functions will improve readability of your script, and thus will make maintenance a lot easier. So "comment out" any On Error Resume Next lines while testing/debugging.Īnd whenever you really do need to use On Error Resume Next, check for errors ( If Err Then.), and switch back to On Error Goto 0 as soon as possible. When you're looking for the cause of an error, you do want to see the error messages stating which line in the code generates the error. ![]() (Temporarily) disable all On Error Resume Next lines It will also help you find variables with the wrong scope (local vs. It may seem a nuisance to force yourself to declare all variables, but trust me, Option Explicit will save you a lot of time searching for errors caused by typos in variable names. Make sure you log any requirements that aren't met, and/or display descriptive error messages.Īlways use Option Explicit and declare all variables
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |