PC Review


Reply
Thread Tools Rate Thread

Convenient way to ignore Debug.Assert ?

 
 
Sing
Guest
Posts: n/a
 
      28th Oct 2007
Dear Excel Gurus,

I put in several Debug.Assert in my code to catch bugs more easily. As I am
going to deploy the code soon, is there any convenient way to ignore the
Debug statements for the deployment version?

Thanks for your help.


 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      28th Oct 2007
> I put in several Debug.Assert in my code to catch bugs more easily. As I
> am
> going to deploy the code soon, is there any convenient way to ignore the
> Debug statements for the deployment version?


You can use Edit/Replace in the VBA editor to replace them with blank lines.
Put this...

*debug.assert*

in the Find What field, leave the Replace With field blank and put a check
mark in the Use Pattern Matching check box.

The other possibility if you don't want to lose them completely is to turn
them into comments. Again, in Edit/Replace, put this...

debug.assert

in the Find What field and put this...

'debug.assert

(note the leading apostrophe) in the Replace With field.

Rick

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      28th Oct 2007
You may want to add a public variable that you can toggle.

Public DevelopmentMode as Boolean

Then somewhere
DevelopmentMode = True

Then you could use
if developmentMode = true then
debug.assert ...
End if

Who knows if it's worth the effort for this project--but, heck, it may be worth
it when you get that first bug, er, enhancement request next week!



Sing wrote:
>
> Dear Excel Gurus,
>
> I put in several Debug.Assert in my code to catch bugs more easily. As I am
> going to deploy the code soon, is there any convenient way to ignore the
> Debug statements for the deployment version?
>
> Thanks for your help.


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Debug.Assert Peter Morris Microsoft C# .NET 10 1st Aug 2008 07:58 PM
Any equivalent to debug.assert? Brian Cryer Microsoft ASP .NET 3 30th Apr 2007 03:49 PM
When is Debug.Assert pertinent to use ? Steve B. Microsoft Dot NET Framework 4 22nd Jun 2006 12:07 AM
Cannot use Debug.Assert Michi Henning Microsoft VB .NET 4 16th Sep 2004 12:02 AM
Debug.Assert puzzle! emma middlebrook Microsoft C# .NET 4 17th Dec 2003 07:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:09 AM.