Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Finding Procedure which generated error

Hi

I have a worksheet with several modules each with several procedures.
I have dealt with all the errors I can anticipate (which means there
must be some that I have not dealt with!) and have handled those with
a common 'if all else fails' error procedure. This will leave the
worksheet in a 'safe', mode ensuring sheets are hidden or protected.

The procedure also generates a message showing Err.Number and
Err.Description, however it would be useful to know which procedure
actually generated the error so that when I get a call about it I know
where to start looking.

I tried using Err.Source but that just gives the name of the entire
project - not the module or better still, the procedure name.
Is this possible?

Thanks

LS
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding Procedure which generated error

Only if you write code that passes the information to your error handler.
In other words, no there is no property or method that will return any
information about where the error occured.

that said, here is some discussion on the arcane ERL function

http://groups.google.com/groups?thre...40bmsltd.co.uk

--
Regards,
Tom Ogilvy


Hi

I have a worksheet with several modules each with several procedures.
I have dealt with all the errors I can anticipate (which means there
must be some that I have not dealt with!) and have handled those with
a common 'if all else fails' error procedure. This will leave the
worksheet in a 'safe', mode ensuring sheets are hidden or protected.

The procedure also generates a message showing Err.Number and
Err.Description, however it would be useful to know which procedure
actually generated the error so that when I get a call about it I know
where to start looking.

I tried using Err.Source but that just gives the name of the entire
project - not the module or better still, the procedure name.
Is this possible?

Thanks

LS



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Finding Procedure which generated error

Have to do it manually.Create a public variable and set that in each
procedure, like

Dim callProc As String

Sub proc1()

callProc="proc1"
'...
End Sub


Sub proc2()

callProc="proc2"
'...
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"LS" wrote in message
om...
Hi

I have a worksheet with several modules each with several procedures.
I have dealt with all the errors I can anticipate (which means there
must be some that I have not dealt with!) and have handled those with
a common 'if all else fails' error procedure. This will leave the
worksheet in a 'safe', mode ensuring sheets are hidden or protected.

The procedure also generates a message showing Err.Number and
Err.Description, however it would be useful to know which procedure
actually generated the error so that when I get a call about it I know
where to start looking.

I tried using Err.Source but that just gives the name of the entire
project - not the module or better still, the procedure name.
Is this possible?

Thanks

LS



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Finding Procedure which generated error

Many thanks to both Bob & Tom for their replies.
I used a variable in each module and it works fine.

LS
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
simplify procedure to get rid of 0 error values in a spreadsheet Frederic Excel Worksheet Functions 1 February 8th 06 04:47 AM
VBA Compile error: Procedure too large? Jerry Dyben Excel Discussion (Misc queries) 1 October 31st 05 10:15 PM
How to remove red strikethrough generated as an error? FiscallyCOC Excel Discussion (Misc queries) 1 October 5th 05 06:56 PM
Error: The procedure number is out of range Van S. Mabrito Excel Programming 1 February 19th 04 11:33 AM
EXCEL.EXE has generated an error...when closing a workbook HEIKKILÄT Excel Programming 1 September 17th 03 09:16 PM


All times are GMT +1. The time now is 04:24 PM.

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"