Excel 2010 VBA - Do you use the Object Browser?

I find the object browser of limited usefulness.  Am I the only one?

Some subs/methods are displayed as functions.
It doesn't make sense because a function returns a value and a sub does not.

am I wrong?
Or are there some uses for the object browser that I'm missing.
brothertruffle880Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Some subs/methods are displayed as functions.
What do you mean by that?

If you open the Object Browser and click on a class like 'ComboBox' it will show you all the events, properties and methods. Clicking on one of them gives helpful information.
0
Jacques Bourgeois (James Burger)PresidentCommented:
It's the best tool you can get to explore what is available in a library, and what are the properties and methods of each class.

And it still have a usable search mechanism, something that is missing in the last versions of the Office help.

In many instances, it's a lot faster to search in there than in online help to find the property or method that will do something you need. Once you have found it there, then F1 brings you in Help with more details.
0
brothertruffle880Author Commented:
HI Martin:
Range.Activate is also a sub (method) because it does not return a value but it is listed as a function in the browser.

Or do I have a misunderstanding.  (I'm still on my road to mastery!)
0
Jacques Bourgeois (James Burger)PresidentCommented:
This is because Excel is not coded in VB, it is coded in C++. If you explore the Explorer further, you will see that most of the methods that do not return a value are also presented as Function. There are relatively few Sub.

Without the source code, it is hard to explain exactly why this is so, and the tool that extract the information from the library to present it in the Explorer might also be at cause here, but here are a few possible pointers.

C++ does not make the distinction that VB makes between a Sub and a Function. In C++, what you call a Sub is a Function declared as type void instead of one of an Integer or a String or whatever. This is hidden for the VB developer because he would not know what a void is.

C++ also enables you to have many methods with the same name, as long as they do not have the same set of parameters. It's called overloading, something that does not exist in VBA. Some of these overloaded methods might also be declared as internal, once again something that does not exists in VBA. It's an alternative to Private and Public that leaves the method visible inside the application in which it is defined (Excel), but hides it from external applications such as VBA. This might come into play when the Object Browser builds its list.

If you really make the differentiation between a Sub and a Function in the object model, simply look for a As clause at the end of the declaration that is presented.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.