Excel VBA Automatic help


I have been working with Excel VBA for a year now and am still not sure of why the automatic help seems to work sometimes and other times not.
By automatic help I mean typing in eg Application. and seeing a list box of certain options that you can choose from.

Are there any guidelines on how this works and how to get the most out of it.


Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
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.

Typically, if the object you are trying to get to is strongly-typed (early-bound), Intellisense will pop up the methods and members.  Often, some of these objects are just defined as Object, which have no direct members, but are set to a type, as required (late-bound).  In this case, you have to cast the Object-defined objects to their strongly-typed counterparts.  If you look at the Object Browser (F2), you can see which have been defined properly.  

For example:

    - ActiveCell is correctly defined as a Range and will use Intellisense to display the members
    - ActiveSheet, while technically containing all the methods of a Worksheet, is incorrectly defined as an Object; Intellisense will not work.

To rectify ActiveSheet, do:

    Dim oSheet As Excel.Worksheet
    Set oSheet = ActiveSheet

The Dim...As... command strongly types the variable, oSheet, as a Worksheet (with all the members available).  The Set command makes the strongly-typed oSheet point to the same memory as ActiveSheet (any changes to oSheet will reflect on ActiveSheet too).  Now you can do 'oSheet.' and all of ActiveSheet's members will pop up in Intellisense.



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
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Great in-depth answer!
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
Visual Basic Classic

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.