Hello Guest it is March 28, 2024, 03:32:01 PM

Author Topic: Debugging VB  (Read 2152 times)

0 Members and 1 Guest are viewing this topic.

Debugging VB
« on: December 12, 2010, 02:46:07 AM »
A beginner question...

Is there a simple way to log the variable states in a vb script as it runs so that I can see what actually happened after it runs ? (a log file for instance)

I understand stepping through with the VB editor functions but my macro uses waits and timers so runs differently at full speed to stepping through so I need something that lets me look after running to see what happened.

Thanks

Paul
Re: Debugging VB
« Reply #1 on: December 12, 2010, 05:43:09 AM »
Ok

I found a way.
Just wrote the bits I am interested in to a log file. I just needed to look up the file handling functions.

Open "M6start_log" For Output As #1 'open a file to write logs to
Write #1, "your text ", Your Variable
Write #1, "OldTool ", OldTool  'for instance, add as many lines of this as you like through your script
Close #1 'closes the log file

After running your macro, you should end up with a logfile in the same folder as your macro.
Dont forget to delete or comment out the logfile creation lines once you have debugged or you will eventually fill your disk up with spurious logs.

There may be a simpler way but this worked for me.

Paul