Excel VB Editor output stack and/or intermediate window to file

G

Gum

I would like to output (dump) the information in the stack and/or
intermediate window of Excel VB Editor to a disk file. How can this be done?
 
J

Jon Peltier

Instead of using Debug.Print, I have a routine called DebugPrint which
outputs the date and time plus the Debug string to a text file. I don't know
about the stack.

- Jon
 
G

Gum

That would help. If I cannot get the stack, then I could get proxy data that
I can put in the same dump file.
 
J

Jon Peltier

Public Sub DebugPrint(sLogEntry As String)
' write debug information to a log file

Dim iFile As Integer
Dim sFileName As String

sFileName = ThisWorkbook.Path & "\debuglog" & Format$(Now, "YYMMDD") &
".txt"

iFile = FreeFile

Open sFileName For Append As iFile
Print #iFile, Now; " "; sLogEntry
Close iFile

End Sub


- Jon
 
G

Gum

Excellent!

Jon Peltier said:
Public Sub DebugPrint(sLogEntry As String)
' write debug information to a log file

Dim iFile As Integer
Dim sFileName As String

sFileName = ThisWorkbook.Path & "\debuglog" & Format$(Now, "YYMMDD") &
".txt"

iFile = FreeFile

Open sFileName For Append As iFile
Print #iFile, Now; " "; sLogEntry
Close iFile

End Sub


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top