>GRSoftware >VBA Tutor >Newsletter Issues >Newsletter #2 >Newsletter #4

VBA TUTOR NEWSLETTER #3~ 1-2-2000

Help for the beginner to intermediate VBA programmer

Seeing we had a few queries about the use of the 'selection' object in both 'tut1' and 'tut2', this issue will concentrate on 'objects' and their use.

~ VBA in GENERAL ~

First, go to the following 'VBA Help' tutorial web page for an overview of the concept of Objects and Properties.
Next, you would have noticed that the 'Selection' Object and it Properties were referenced in the following way in 'tut2':

Selection.Font.Size

'Selection' was the object, and 'Font.Size' was one of the many possible properties.
To view OBJECTS and their PROPERTIES, first open the VB Editor and then open the 'Object Browser' by selecting View|Object Browser, or press 'F2'. You are presented with a listing of the objects, referred to as 'Classes', and their properties, referred to as 'Members'. [There is also another method that will be looked at in the 'tut3' below.]

~ VBA in WORD ~

Now that you have an idea of what an object is, the following code demonstrates how to reference the properties of Objects by using the 'with' statement, in this case, the active document. Using the 'with' statement, you do not have to reiterate the objects name for each value.

Sub getInfo()
With ActiveDocument
MsgBox (.Words.Count - 1)
MsgBox .Creator
End With
End Sub


The following tutorial, tut3.htm, is a simple exercise that demonstrates how to use objects by creating a 'funfont' macro.

~ COOL WORD RESOURCE ~
WORD Objects from the Microsoft Office Developer web site

~ VBA in EXCEL ~

This following tip is not a VBA tip, but is given here because it is one of the main features of Excel that is not used. This feature is the 'GoTo Special' dialog. This dialog allows you to select, for example, only data that is numeric in a range.
To access this dialog, select the Edit|Go To Menu Item, or press 'F5', then, after either selecting a named range or entering a cell reference, click on the 'Special' button to select the 'filtering' criteria to be used.

~ COOL EXCEL RESOURCE ~ EXCEL Objects from the Microsoft Office Developer web site

~ VBA in ACCESS ~

Using VBA in ACCESS is not one of our strengths, although we are working on it. So, in this section we will just point you towards some excellent resources.

~ COOL ACCESS RESOURCE ~
ACCESS Objects from the Microsoft Office Developer web site
[ SKILL LEVEL: Intermediate to Advanced ]


You're getting smarter...

VBA TIP REQUEST FORM
Contact Name:
Tip Request:
Unsubscribe from this newsletter!

© 2000 Gary Radley