+ Reply to Thread
Results 1 to 7 of 7

Where do I place #CONST DEBUG_MODE = True in my workbook?

  1. #1
    Forum Contributor
    Join Date
    10-07-2011
    Location
    Plano, TX USA
    MS-Off Ver
    Excel 2013
    Posts
    141

    Where do I place #CONST DEBUG_MODE = True in my workbook?

    Hi -
    I'm trying to use conditional complile and I am not sure where to place the following:

    Please Login or Register  to view this content.
    Currently, I have it declared at the top of "ThisWorkbook" object.

    I want to be able to enable some MSGBOX lines throughout my workbook when I am developing but turn them all off when I release.

    Thanks,
    Jim

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Excel 2016
    Posts
    10,171

    Re: Where do I place #CONST DEBUG_MODE = True in my workbook?

    Hi Jim,

    Try placing it at the top of a regular module
    HTH
    Regards, Jeff

  3. #3
    Forum Contributor
    Join Date
    10-07-2011
    Location
    Plano, TX USA
    MS-Off Ver
    Excel 2013
    Posts
    141

    Re: Where do I place #CONST DEBUG_MODE = True in my workbook?

    Thanks Jeff but that would require me to place it on every module and object. Is there a central place to declare the statement once so that it is available everywhere, i.e. a public decaration?

    Jim

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,202

    Re: Where do I place #CONST DEBUG_MODE = True in my workbook?

    Declare it as Public
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,677

    Re: Where do I place #CONST DEBUG_MODE = True in my workbook?

    From Help:

    Conditional compiler constants are always Private to the module in which they appear. It is not possible to create Public compiler constants using the #Const directive. Public compiler constants can only be created in the user interface.
    To declare in the UI, from the VBE, Tools > VBA Project Properties, Conditional Compiler Arguments:

    DEBUG_MODE = 1: SomeOtherConstant=0: SomeThirdConstant=42

    Values can only be Integers.
    Last edited by shg; 06-09-2012 at 12:23 PM.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Contributor
    Join Date
    10-07-2011
    Location
    Plano, TX USA
    MS-Off Ver
    Excel 2013
    Posts
    141

    Re: Where do I place #CONST DEBUG_MODE = True in my workbook?

    Thanks Roy but
    Please Login or Register  to view this content.
    doesn't work.

    This all works if I use the #CONST DEBUG_MODE = True on every Module, Form, & Object. Unfortunately, that would require me to set the variable to False for every Module, Form, & Object.

    I was asking is there ONE place where I could place the statement for the entire workbook?

  7. #7
    Forum Contributor
    Join Date
    10-07-2011
    Location
    Plano, TX USA
    MS-Off Ver
    Excel 2013
    Posts
    141

    Re: Where do I place #CONST DEBUG_MODE = True in my workbook?

    Thanks shg. That worked and I learned someting new.

    Jim (From Texas too)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1