Does anybody know of a way to dump a list of variables and their present values.
I know that you can examine variables when developing, but I want to be ale to log them to a file, when an error ocours once the program is in real use.
There isn't really an easy way to do it. Unless, of corse, your variables are in arrays... Then it's a cinch.
Without Arrays:
Open App.Path & "ErrLog.txt" for output as 1
Print #1, "Variable1 Value:"
Print #1, Variable1
Print #1, "Variable2 Value:"
Print #1, Variable2
Print #1, "Variable3 Value:"
Print #1, Variable3
And so on...
Close 1
With Arrays:
Open App.path & "ErrLog.txt" for output as 1
For i = 1 to NumberOfValuesInTheArray
Print #1, "Array(" & i & " Value:"
Print #1, Array(i)
next i
Close 1
You may need to edit the pathname somehow so that it doesn't overwrite itself, and you may need to change the file number if you're already using "1".
That's about all I can give you, hope that helps. I'm not really an expert, I just know the simple stuff.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.