+ Reply to Thread
Results 1 to 4 of 4

What does Debug.Print do?

  1. #1
    Registered User
    Join Date
    02-10-2011
    Location
    Copenhagen, DK
    MS-Off Ver
    Excel 2007
    Posts
    30

    What does Debug.Print do?

    Hi y'all!

    Thanks for alle the help!

    I found this code in another community:
    Please Login or Register  to view this content.
    I do not know what Debug.Print does? do any of you know that?

    I have added Analysis tool pack in "Add-in" and i have "checked" ATPVBAEN in VBA window. Thus, Edate should work in VBA, but it doesn't... Do you have any suggestions?

    Kind regards
    KRAND
    Last edited by KRAND; 06-06-2011 at 06:08 AM.

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

    Re: What does Debug.Print do?

    This might help

    Chip Pearson
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    02-10-2011
    Location
    Copenhagen, DK
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: What does Debug.Print do?

    Quote Originally Posted by royUK View Post
    This might help

    Chip Pearson
    Hi RoyUK,

    That did indeed help me to understand the function. Thanks!

    If anyone out there has the same issue as me, here is a little quote from Chip Pearson:
    ----------------------------------------
    "You can use the Debug.Print statement anywhere in your code to display messages or variable values in the Immediate Window. These statements don't require any confirmation or acknowledgement from the user so they won't affect the operation of your code. For example, you can send a message to the Immediate Window when a particular section of code is executed.

    '
    ' some code
    '
    Debug.Print "Starting Code Section 1"

    The liberal use of Debug.Print statements makes it easy to track the execution of your code. Debug.Print statements have no effect on the execution of your code and so it is safe to leave them in code projects that are distributed to end users. Debug.Print statements send messages to the Immediate Window, so you should have this window open in order to see the messages.

    Unfortunately, there is no way to programmatically clear the Immediate Window. This is a shortcoming that has frustrated many programmers."
    ----------------------------------------

    NB: You can get the immediate window in VBA by pressing Ctrl+G

  4. #4
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: What does Debug.Print do?

    No way to clear the immediate window? Well there isn't a nice way but this does the trick

    Please Login or Register  to view this content.
    That does it but I find there is a strage gotcha that I cannot explain. If your macro then goes on to do debug.prints, you see them arrive.
    Then when the macro ends, the windows is instantly cleared again; now that's overkill. I found you have to leave something. I chose a space:
    Please Login or Register  to view this content.
    Last edited by brynbaker; 07-12-2013 at 08:42 AM. Reason: completion & caveat

+ 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