Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Koila Malik   on Jan 01 In MS Office Category.

  
Question Answered By: Alfonsine Miller   on Jan 01

> 1. What are the other items  in the Excel Collection(s)? Where can I
find  a list  of such things, so I know what I can refer  to and what its
> proper name is?

Excel has collections  for pretty much anything that can be collected. :-)
I don't know if there's anywhere they're all listed. Basically you can
assume that if you want a collection of something, then Excel already has
it. Ask specific questions  of Google and you'll probably find examples for
it.

> How am I to know that worksheet  objects are called
> "Sheets" and not "Worksheets" or "Tabs"?

Any introduction to Excel would probably have knocked "tabs" on the head.
Not so sure about "sheets" vs "worksheets". But again, a search for
examples will point you in the right direction.

> 2. I notice that when I record  a macro, the whole thing  is called  a
> "sub". I imagine that's what makes it callable by name from other
> macros. What's a "procedure" and how do procedures  relate to macros
> and subs?

A sub is a subroutine. The other similar type of construct is a function.
Functions return a single value as a "result"; subroutines do not. In
modern Excel, there is not actually such a thing as a "macro", although
there are still facilities to allow you to record them and otherwise control
them. But you are actually recording VBA subroutines in VBA modules.

And yes, they can be called by name from other code.

"Procedure" is a generic term that might refer to either a subroutine or a
function. It depends on the context. (Note that the Pascal language
actually calls subroutines "procedures" - so ex Pascal people, like me,
might use the term to mean subroutine. Also, C and similar languages call
both subroutines and functions "functions" - again leading to confusion on
occasions.)

> 3. How is "method" defined, and where can I find a list of the
methods  available in Excel VBA? Is a method  a kind  of verb that acts
> on an object, which is analogous to a noun? How can I find the
> syntactical requirements for methods, and for that matter, what they do)?

I don't think the term "method" is used around Visual Basic, although I
could well be wrong. Typically, though. "method" is a term used in
object-oriented programming. A "method" is a piece of code that is part of
an object  and is accessible to code outside the object (public methods).
The term "private method" is also used sometimes to refer to code in an
object that is not accessible from outside. A "method" can be either a
subroutine or a function. VBA allows you to create public and private
routines inside modules and class modules. These look pretty much like
methods in objects.

In structure and calling sequence they are simply subs and functions.
However, you will typically need to use "dot notation" to access them - i.e.
the object name, then a full-stop, then the method name.

Excel has internal objects, which have methods and attributes
(values/variables). An easy way to find which ones exist for a particular
object is to type the object's name and the full-stop, and wait for Excel
to give you a list. The help is pretty good too.

I suggest you don't set out to try to learn a wide slab of Excel -
instead choose something you want to program, and find out how to use the
facilities in that narrow slice of functionality. With Excel, if you need a
construct, you can be pretty sure that it'll be there - just chase down what
it's called using Google or help.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Beginner Questions About Terms Or get search suggestion and latest updates.


Tagged: