+ Reply to Thread
Results 1 to 2 of 2

Error handling

Hybrid View

  1. #1
    Registered User
    Join Date
    02-15-2006
    Posts
    93

    Error handling

    Good afternoon,

    I am working on developing something that has multiple modules and subs... Anyway, I am wondering if anyone can give me ideas on the most effective way of dealing with errors if they occur while the program is running. I don't want users to have the program to freeze up on them. Instead I would like it to i.e. return to the beginning of the program or even shut down so that the user has to reload.

    I don't know how I can manage this without making a reference in every sub routine. For instance, could I put something in the "This Workbook" excel object that would handle the error at anytime the workbook is open.

    2nd question, is there any code that would unload any active userforms?

    Thanks in advance for any ideas!
    Cheers,
    dw

  2. #2
    Jim Thomlinson
    Guest

    RE: Error handling

    You need to have error handling in every procedure and function. There is no
    way around it. What the error handler does in each procedure will be specific
    to the error generated. Make sure that your error handler resets all
    application level settings such as "Applicaton.displayalerts" ... As a
    general rule well written code will rarely if ever invoke the error handler.
    That being said good code will handle anything that is thrown at it and deal
    with any errors appropriately.
    --
    HTH...

    Jim Thomlinson


    "toocold" wrote:

    >
    > Good afternoon,
    >
    > I am working on developing something that has multiple modules and
    > subs... Anyway, I am wondering if anyone can give me ideas on the most
    > effective way of dealing with errors if they occur while the program is
    > running. I don't want users to have the program to freeze up on them.
    > Instead I would like it to i.e. return to the beginning of the program
    > or even shut down so that the user has to reload.
    >
    > I don't know how I can manage this without making a reference in every
    > sub routine. For instance, could I put something in the "This
    > Workbook" excel object that would handle the error at anytime the
    > workbook is open.
    >
    > 2nd question, is there any code that would unload any active
    > userforms?
    >
    > Thanks in advance for any ideas!
    > Cheers,
    > dw
    >
    >
    > --
    > toocold
    > ------------------------------------------------------------------------
    > toocold's Profile: http://www.excelforum.com/member.php...o&userid=31608
    > View this thread: http://www.excelforum.com/showthread...hreadid=546022
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1