Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 08:04:40 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Debugging VB
Pages: 1   Go Down
Print
Author Topic: Debugging VB  (Read 316 times)
0 Members and 2 Guests are viewing this topic.
bigbloke
Active Member

Offline Offline

Posts: 21


View Profile
« 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
Logged
bigbloke
Active Member

Offline Offline

Posts: 21


View Profile
« 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





Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!