List of variables in a Module

bjdesa

New Member
Joined
Oct 15, 2010
Messages
8
Yes I have been looking for a way to get VBA to list all the variables in a module. I did find some code that lists all the functions from Microsoft’s MSDN website. In the VBA editor I know there is a local window that lists all the variables but the stupid thing allows me to copy only one variable at a time. The same is true if I use the F2 key to bring up the object browser. In FORTRAN the IDE allows me to copy the whole list. Would appreciate any help you could provide. Having a list of variables helps me to debug code.
 
Hi there, and welcome to the board!

Yes, a lot of differences between the Fortran IDE and the Visual Basic IDE. You would need code to get a list. Some add-ins have this built into it, as I believe MZ Tools does. The question really needs to be: why? What is it you are trying to do via debuggin?
 
Upvote 0
You could copy the code, trim it, copy to a worksheet, sort, and copy all the Dim/Public/Private/Global statements (which you have used religiously).
 
Upvote 0
Why not just use the Locals window?

It will list all the variables in scope/context when you are running code, that might be more useful than a list of variables.

By the way how did you get the list of functions from MSDN?

Does the list include all functions for every version of Excel?

Or were you only interested in a particular version or functions of a particular 'type'?
 
Upvote 0
Zack,
The very fact your asking me why I need to know the list of variables implies that you do not know the answer to my question. Intel FORTRAN uses “Microsoft Visual Studio 2008” since the FORTRAN compiler used to be MS FORTRAN many years ago. Having a list of the variables I can write code to let me know what type of variable the variable is. Variant variables are a curse and the people who came with the idea should be hung. My job is always cleaning other peoples mess. So having a list of variables I can write code that prints the variables type and name of the variable as the code executes and then I have code that will generate the code in the form “Dim VAR1 as Double “ and so on.
 
Upvote 0
If I may be curious, does this mean the "debugging" is just removing variants - or is it failing besides that? Are you working in Excel vba with this project? Your appraisal is somewhat harsh (besides, that, if you think VBA is bad then I don't think you should ever even look at JavaScript as it will probably put you over the edge).

Regards,
ξ
 
Upvote 0
Ah, that sort of thing - I actually thought you meant Excel VBA inbuilt functions etc

I've not checked out the whole thread but I think it would be pretty straightforward to get a simple list of all the variables.

Obviously they would have to be declared and the 'simple' part might disappear when you start looking into what actual information you want.

Just the names? The types?

If they are objects details of their properties, events, method etc...

Also, how to display the data? A simple listbox? A hierarchical control like a TreeView?
 
Upvote 0
Xenou,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Again I am again getting questions that run tangent to what I asked. If you can’t answer my question please don’t waste your time trying. I can find other methods to do it I always do. Just felt there was no point it reinventing the wheel. No disrespect to you or anyone that has replied to my posting. Talking about java have you used it for development of CFD software and parallel programming? About me going over the edge I would not go over the edge. If you can program well then there should be no problem porting to another language. Bad programming techniques fall you as much as good programming skills. The best way to develop good programming skills if become an expert at fixing other peoples mess even though I would at time is better just to code the whole **** thing myself.<o:p></o:p>
 
Upvote 0
No problem. I was curious about your ideas concerning vba (or nosey, rather). I'll stay out of your business, then.
ξ
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top