Hello, dee:
Go to the Help file in Excel, and look for "Programming Information" - after
expanding that, choose "Visual Basic Language Reference." You will see it is
organized by topic - I will list the more relevant ones below.
Objects - These are pre-built "things" that can be created and used by your
code. They are really just a set of code that puts all the little pieces
into one big chunk of code that you can access and manipulate by its
properties, methods, and events - saving you the agonizing work of having to
do all that coding yourself. For example, imagine having to draw a window on
the screen, and remember what color everything is on it, and how to scale
everything if it is resized, and how to remember what size it was before it
was minimized... well, you get the point. Someone else had to do all of that
for us, but now there is a Window object that we can easily do all these
things to if we know the properties and methods.
Properties - These are specific to objects and allow you to change the look,
feel, or function of the object. Typical properties would be size, color,
etc. but depending on the object there can be others, sometimes pretty
strange!
Methods - These are like "commands" you can give the object so it will do
something for you. Sometimes you need to specify some parameters to give the
object the specifics (like Move - move to where? You would need to specify).
Events - Specific to objects, events are actions or changes that take place
within an object that can "trigger" a response through an event procedure you
can write
Functions - procedures you can call that (usually) process the information
you send it (in parameters or arguments) and return a value back to you.
Some of these are part of the Basic language, some are specific to Excel, and
then of course you can write your own functions.
There is one other object-related thing that is not in the list:
collections. Collections are when there can be several objects inside
another object. For example, an Excel Workbook has a collection of
Worksheets; and the number can vary; you can create (Add) or destroy (Delete)
members of a collection; but once created they become objects in themselves,
but you have to reference them through their "parent" object, which is why
code may look like this:
ThisWorkbook.Worksheets("Sheet1").Shapes(3).Name = "MyShape"
I would also suggest you learn to use the Object Browser in the VB editor,
if you have not yet done so. You can see a list of all the objects your
project recognizes, and then see all the properties, events and methods.
Each has its own type of icon so you can easily tell what is a property, what
is a method, what is an event. And it will tell you all the parameters you
need to supply. I use this a lot, and the if I have more questions I will
point to something in the list and hit "F1" to get help on it.
Hey, we all had to learn this, so we know how confusing it can be but I hope
this helps get some of it straight!
dee said:
Hi again,
I'm keeping you busy today! Thank you so much.
OK, I'm following what you explained. So, that means that the main pieces,
if you will, of VBA code would be:
Objects
Properties
Methods
Arguments
Constants? (Still unsure of how these are defined)
Are there any other standard "pieces" that I should be researching?
Thank you so very much.