PDA

View Full Version : Solved: Determine Variables and Values



wagnet
05-03-2006, 09:03 AM
Is there a way to determine what variables are currently set in VBA, their format, and their current value?

I'm running VBA code written by someone else and I'd like to be able to "trap" the above information & record the variable settings to a worksheet:help ....something like:

x = 1
r = 1
Do
Cells(r,1) = Variable(x).Name
Cells(r,2) = Variable(x).Format
Cells(r,3) = Variable(x).Value
r = r + 1
Loop Until x => ???

Norie
05-03-2006, 09:33 AM
Are you just trying to see what the code does?

If so you could use the various debug features. eg the Locals Window, the Watch Window, breakpoints etc

wagnet
05-03-2006, 10:39 AM
Actually, I want to be able to capture and save the variable values, so upon subsiquent executions of the same template, I might be able to re-load the same values (and start where I left off).

Norie
05-03-2006, 10:45 AM
Well I'm afraid you can't refer to variables like this.


Variable(x).Name

wagnet
05-03-2006, 11:09 AM
:(

All of my hopes and dreams just vanished. :giggle

Thanks,