+ Reply to Thread
Results 1 to 6 of 6

'Exporting' contents of Locals Window

  1. #1
    Registered User
    Join Date
    10-17-2008
    Location
    UK
    Posts
    17

    'Exporting' contents of Locals Window

    Hi,

    This one has me a little stumped. I have been making some changes to a VBA application in excel and somewhere along the line a variable contains the wrong value. For various reasons it is not trivial to trace the variable or variables. What i want to be able to do is copy the entire contents of the locals window including all the expanced arrays etc to another program (possibly excel) and then i can compare them with the original program at the same point in execution and spot the differences.

    is this possible? if not i will have to write a windows automation tool to copy and paste a line at a time!

    Many Thanks
    Stephen

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436
    Can you not set a watch to halt the program when the value changes?

    I'm not aware of anything that dumps variable information to a file.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    10-17-2008
    Location
    UK
    Posts
    17
    Hi Andy,

    A watch would only let me watch one variable (i can add many), essentially i want to stop the program at a particular point in execution, get a 'map' of every variable and then repeat the same thing with the previous version of the code. the are many hundreds of variables which are frankly a nightmare to sift through (this is an inherited project, as so many are).

    i have written a quick script to 'automate' the copy and paste process from the locals window. however it is not a quick or elegant solution.

    Regards
    Stephen

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436
    You know you can use conditions when setting a watch?

  5. #5
    Registered User
    Join Date
    10-17-2008
    Location
    UK
    Posts
    17
    I am aware of this. essentially i am looking to get a complete dump of the variables so that i can compare two files with thousands of variables. since i can only run one copy of VBA at a time (as far as i know) i cannot compare two live windows halted at the same position.

    i have written a short script in AutoIT to activate the locals window and copy each item to a file. its a bit slow but it gets me what i need.

    thanks again
    stephen

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436
    Was just checking.

    Although you can not run 2 sets of code at once perhaps you can run 2 instances of excel.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1