HELP! Object, Properties & Methods

D

dee

I'm struggling with these. IN the following code:
ActiveCell.Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

Am I correct is assuming:

ActiveCell is a property of Range object and Select is a method

Application.CutCopyMode=False means The CutCopyMode property of the Excel
object is False (property)

Selection.Copy means Copy (method) the selection (range property)

PasteSpecial is a method applied to the range object (selection property)

Paste: xlPasteValues, etc. are all properties, but of what? The Selection?

I have searched quite extensively, but to find easy to understand, plain
English definitions of objects, methods, properties, constants, etc.
difficult to find.
 
T

Tom Ogilvy

ActiveCell is a property of Range object and Select is a method

No. ActiveCell is a Range Object. It is maintained internally by Excel to
point to the cell which currently has the focus or would have the focus if
that window were activated. Select is a method. One would usually use
ActiveCell.Select to reduce a multi-cell selection to a single cell or in
Excel 97 to overcome a bug in the ActiveX controls
Application.CutCopyMode=False means The CutCopyMode property of the Excel
object is False (property)

If a range has been copied to the clipboard (the standard, not the office
clipboard), this clears the clipboard and removes any copy marquee.


Selection.Copy means Copy (method) the selection (range property) Yes


PasteSpecial is a method applied to the range object (selection property) Yes

Paste: xlPasteValues, etc. are all properties, but of what? The Selection?
No, they are arguments to the pastespecial method. If you manually do a
copy then do Edit=>PasteSpecial, you are confronted with a dialog with many
possible selections. These arguments represent those selection
possibilities.
 
D

dee

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.


Tom Ogilvy said:
ActiveCell is a property of Range object and Select is a method

No. ActiveCell is a Range Object. It is maintained internally by Excel to
point to the cell which currently has the focus or would have the focus if
that window were activated. Select is a method. One would usually use
ActiveCell.Select to reduce a multi-cell selection to a single cell or in
Excel 97 to overcome a bug in the ActiveX controls
Application.CutCopyMode=False means The CutCopyMode property of the Excel
object is False (property)

If a range has been copied to the clipboard (the standard, not the office
clipboard), this clears the clipboard and removes any copy marquee.


Selection.Copy means Copy (method) the selection (range property) Yes


PasteSpecial is a method applied to the range object (selection property) Yes

Paste: xlPasteValues, etc. are all properties, but of what? The Selection?
No, they are arguments to the pastespecial method. If you manually do a
copy then do Edit=>PasteSpecial, you are confronted with a dialog with many
possible selections. These arguments represent those selection
possibilities.
 
T

Tom Ogilvy

There are also variables, functions, subroutines (both also refered to as
procedures).

within variables there are many types, but of interest would be Array's and
user defined types.

If you go to the VBE and choose help, then look at the index, it basically
lays all this stuff out for you.

--
Regards,
Tom Ogilvy




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.
 
K

K Dales

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.
 
T

Tom Ogilvy

Instead of Index I should have said Contents

for example, under conceptual topics:

Understanding Objects, Properties, Methods, and Events
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top