LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Error message - state all strings

Better ways but to quickly find out what's going wrong something like this -

Public gbDebug As Boolean

Sub Test()
Dim bOK As Boolean
Dim s1$, s2$, s3
Dim n As Long

gbDebug = True ' normally set in some other proc
On Error GoTo errH:
s1 = "aaa"
s2 = "bbb"
n = 1 / 0
s2 = "ccc"
bOK = True
done:

MsgBox "All OK: " & bOK

Exit Sub
errH:
If gbDebug Then
Debug.Print "Err: " & Err.Number, Err.Description
Debug.Print "s1: "; s1
Debug.Print "s2: "; s2
Debug.Print "s3: "; s3
Stop
'ctrl-g to view Immediate window
' F8 to step to line that triggered error
' or drag yellow cursor down to skip
Resume
End If
Resume done
End Sub

Regards,
Peter T

"cereldine" wrote
in message ...

Sorry should have explained myself better, i have a lot of worksheets
that open depending on a string value, there have been occassions when
i have been debugging when these strings or search values have been
blank, i thought that if i could output all the current strings with
the value they hold at the time of error then i could narrow down
problem.

Perhaps a better way of putting it would be how do i return the values
for all variables in my procedure at the time when code breaks?


--
cereldine
------------------------------------------------------------------------
cereldine's Profile:

http://www.excelforum.com/member.php...o&userid=32069
View this thread: http://www.excelforum.com/showthread...hreadid=554916



 
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
replace state names with state code abbreviations se7098 Excel Worksheet Functions 3 July 25th 09 06:41 PM
How can I show state-by-state data (as silos) on a map of NA Rob Charts and Charting in Excel 0 November 5th 07 03:41 PM
Converting State Names to State Abbreviations aznate Excel Discussion (Misc queries) 1 October 20th 06 06:52 AM
Type mismatch error problem when dealing with Strings David Goodall[_2_] Excel Programming 4 June 30th 05 01:40 PM
changing the message in an error message The Villages DA Excel Worksheet Functions 2 February 18th 05 05:30 PM


All times are GMT +1. The time now is 03:10 PM.

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

About Us

"It's about Microsoft Excel"