Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Error handling

Does anyone know the VB code in excel to produce an error message if the
code breaks down. For example if the user doesn't select from a drop down
list it tells them to "Select from the list"


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Error handling

On Oct 13, 9:17*pm, "Jim Lavery" wrote:
Does anyone know the VB code in excel to produce an error message if the
code breaks down. For example if the user doesn't select from a drop down
list it tells them to "Select from the list"


Hi Jim,

You seem to be talking about two different things here. The example
you use is actually Validation, which is generally used to prevent
errors from happening. Handling an error after it has happened is a
different matter.

Which of the two are you actually seeking help on and can you expand
the context a little. What are trying to do and do you have some
example code you can post?

Br, Nick.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Error handling

I have 2 command buttons The first prints the complete IT plan of the
building (About 30 pages)
The second asks the user to select from a drop down list the floor & wing &
prints that 1 page.

If the user doesn't select the Floor/wing but selects that command the code
breaks down. If I put in an On error message to handle the error it then
gives the message but then goes on to print the 30 pages.





"Nick H" wrote in message
...
On Oct 13, 9:17 pm, "Jim Lavery" wrote:
Does anyone know the VB code in excel to produce an error message if the
code breaks down. For example if the user doesn't select from a drop down
list it tells them to "Select from the list"


Hi Jim,

You seem to be talking about two different things here. The example
you use is actually Validation, which is generally used to prevent
errors from happening. Handling an error after it has happened is a
different matter.

Which of the two are you actually seeking help on and can you expand
the context a little. What are trying to do and do you have some
example code you can post?

Br, Nick.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Error handling

On Oct 14, 8:51*pm, "Jim Lavery" wrote:
I have 2 command buttons The first prints the complete IT plan of the
building (About 30 pages)
The second asks the user to select from a drop down list the floor & wing &
prints that 1 page.

If the user doesn't select the Floor/wing but selects that command the code
breaks down. If I put in an On error message to handle the error it then
gives the message but then goes on to print the 30 pages.


Not sure if your command buttons are on a sheet or a form, either way
it seems odd that the user would need to click a button to be asked to
select from a dropdown list.

A better way might be set your 'Print' command button's 'Enabled'
property to FALSE at design time and have the dropdown (rather than
another command button) clearly labelled 'Select Floor/Wing:' Then, in
the dropdown's change event, test the length of the dropdown's text or
value property. If it's greater than 0 then you set the Print button's
enabled property to TRUE otherwise you set it to FALSE (even though
you set it to FALSE at design time you still need to set it to FALSE
after finding a zero length string in case the user entered a value
then deleted it).

This is just a loose overview of how you might tackle the problem. If
you need more help you'll need to specify whether these command
buttons and dropdown are on a VBA Form or a sheet (or a mixture).

Br, Nick.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Err.Description as error proc name trail, error handling Neal Zimm Excel Programming 4 February 25th 10 08:07 AM
Error handling error # 1004 Run-time error [email protected] Excel Programming 3 May 20th 08 02:23 PM
Set Error handling INSIDE error-trap Michelle Excel Programming 6 May 3rd 08 03:30 PM
Error Handling - On Error GoTo doesn't trap error successfully David Excel Programming 9 February 16th 06 05:59 PM
Error handling with a handling routine ben Excel Programming 0 March 15th 05 03:01 PM


All times are GMT +1. The time now is 07:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"