Originally posted by: calpha
Originally posted by: VBboy
I don't know if you still want your answer.. I was just going through all the VB questions.
Do a "Search and Replace" on your code and replace "Debug.Print" with say "DebugPrint". Then, simply implement DebugPrint as a function which will send your output to file instead.
Using Debug.Print directly is generally a bad practice (as you now know 🙂).
Instead, implement a function like I suggested, and then you can add new types
of debug printing, such as to screen. Then you will need to change your code
just once.
Just curious....but why do you consider debug.print a bad practice? A compiled .EXE removes all debug.prints and debug.asserts.
And to the original post. VBBoy's method is by far easier.
However.....you could accomplish the same thing with an Add-In ....and other then being something different to write.....using the general function like vbboy said would be better. Besides the add-in would require "interaction", wouldn't run in the .exe......and the function wouldn't.
I just started writing add-ins a year ago. I still don't know how CodeSmart made their new window w/i the ide......