Consulting

Results 1 to 5 of 5

Thread: Solved: Determine Variables and Values

  1. #1
    VBAX Regular
    Joined
    Jan 2006
    Posts
    20
    Location

    Solved: Determine Variables and Values

    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 ....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 => ???

  2. #2
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    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

  3. #3
    VBAX Regular
    Joined
    Jan 2006
    Posts
    20
    Location
    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).

  4. #4
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Well I'm afraid you can't refer to variables like this.
    Variable(x).Name

  5. #5
    VBAX Regular
    Joined
    Jan 2006
    Posts
    20
    Location


    All of my hopes and dreams just vanished.

    Thanks,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •