PC Review


Reply
Thread Tools Rate Thread

How to disable certain code segment?

 
 
Sing
Guest
Posts: n/a
 
      24th Nov 2007
Dear Excel Gurus,

In C, one can mask off certain code segment by using macros like;
#ifndef DISABLE_XXX
//Code to be disabled
#endif

How can I do the same thing for Excel VBA?

Thank you in advance.


 
Reply With Quote
 
 
 
 
SteveM
Guest
Posts: n/a
 
      24th Nov 2007
On Nov 24, 9:26 am, "Sing" <s...@gmail.com> wrote:
> Dear Excel Gurus,
>
> In C, one can mask off certain code segment by using macros like;
> #ifndef DISABLE_XXX
> //Code to be disabled
> #endif
>
> How can I do the same thing for Excel VBA?
>
> Thank you in advance.


If Condition = TRUE Then
Exit Sub ' to terminate execution of the sub
and return to the calling Sub
End ' to terminate and close (almost)
everything. See the VBA help for details.
EndIF
 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      24th Nov 2007
You don't have the flexibility that you have with C, but you can use
conditional compilation.

#Const EXEC_THIS_CODE = False

Sub AAA()

Debug.Print 1
#If EXEC_THIS_CODE Then
Debug.Print 2
#End If
Debug.Print 3
#If EXEC_THIS_CODE Then
Debug.Print 4
#End If
Debug.Print 5

End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Sing" <(E-Mail Removed)> wrote in message
news:fi98qr$aeu$(E-Mail Removed)...
> Dear Excel Gurus,
>
> In C, one can mask off certain code segment by using macros like;
> #ifndef DISABLE_XXX
> //Code to be disabled
> #endif
>
> How can I do the same thing for Excel VBA?
>
> Thank you in advance.
>
>


 
Reply With Quote
 
FSt1
Guest
Posts: n/a
 
      24th Nov 2007
hi
see this site
http://cpearson.com/excel/vbe.htm

regards
FSt1

"Sing" wrote:

> Dear Excel Gurus,
>
> In C, one can mask off certain code segment by using macros like;
> #ifndef DISABLE_XXX
> //Code to be disabled
> #endif
>
> How can I do the same thing for Excel VBA?
>
> Thank you in advance.
>
>
>

 
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
2 Questions: Code to exit via cmdExit; Code to hide/disable tool b =?Utf-8?B?QW5keUc=?= Microsoft Access 5 22nd Jul 2006 10:24 PM
small code segment causes page not to work with IE KBuser Microsoft ASP .NET 0 5th Apr 2006 07:25 PM
DNS Over a Segment =?Utf-8?B?QmlsbA==?= Microsoft Windows 2000 DNS 20 23rd Feb 2005 08:36 AM
Using a lookup table from code segment Howard Microsoft Access Form Coding 0 11th Jun 2004 06:08 PM
Why UpdateCommand in adapter is null - see code segment James Shen Microsoft ADO .NET 3 7th Nov 2003 06:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:05 PM.