Method M of Object O Failed

Sometimes you may see a message box with the message "Run-time error '..............', Method xyz of Object abc failed". You can either click "End" or "Debug". Clicking End will end your program. Clicking Debug will take you to the offending line. An example is "Method GetDCName of IADsDomain failed". Such errors may occur for a variety of reasons. It could be because you do not have permissions for accessing an object, for example, a domain. Or it could be because the object does not exist. For example, a computer may not be turned on.

It is good policy to use "On error goto" statements before code, which may throw such errors. What you do on trapping these errors depends on what happened. It is always nice if you can recover in some way by allowing the user to try the operation again (Resume), or to try the next statement (Resume Next). A more drastic solution is to abort this operation (Exit Sub). The final solution is to throw up your hands and panic (End)!