ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Piping debug info to a txt file (https://www.excelbanter.com/excel-programming/415975-piping-debug-info-txt-file.html)

Ben

Piping debug info to a txt file
 
Hi all,

Is there a way to, first, shell out command prompt and create a text file.
Then, pipe (append) debug info, such as variable values at different stages
into the text file. I tried to do a debug.print, but it gets cut off after a
certain number of times. By the time code execution is done, only the end
portion appears in the immedidate windows. The top portion is chopped off.

Thanks,

Ben



--


Rick Rothstein \(MVP - VB\)[_2641_]

Piping debug info to a txt file
 
You can use the Open statement to open a file in Append mode and Print
whatever you are now Debug.Print'ing to it instead. The exact set up depends
on where you are running your code from, but I'm thinking something like
this:

Start your output session before you run your code...

FF = FreeFile
Open "c:\temp\yourfilename.txt" For Append As #FF

Run your code and use this to write what you now Debug.Print...

Print #FF, <<Your Output Text

When your code is finished, don't forget....

Close #FF

Rick


"Ben" wrote in message
...
Hi all,

Is there a way to, first, shell out command prompt and create a text file.
Then, pipe (append) debug info, such as variable values at different
stages
into the text file. I tried to do a debug.print, but it gets cut off
after a
certain number of times. By the time code execution is done, only the end
portion appears in the immedidate windows. The top portion is chopped
off.

Thanks,

Ben



--




All times are GMT +1. The time now is 07:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com