Use Option Declare in all your scripts. This will catch any misspellings of variable names during compile, saving much time. Use Is Nothing to test whether the object variable has a useful value before you try to use it. Use On Error to trap the error and take corrective action (or at least print a more specific error message). Pay attention to where object variables are deleted and think about what other objects might depend on them.