Monday, December 17, 2007

Excel Vacabulary

Thousands of line of VBA code in my Resource Workbooks

Here is some vocabulary you might want to adopt so that others can understand you and so you can understand the programmers and discover that they are just ordinary people doing a different job.

Procedure: A set of instruction that you want the computer to execute. In the old days when the computers were small and slow and the languages were not well developed, they were called macros

Objects: They are the building blocks of your procedures (workbooks, worksheets, charts, drawings, controls (buttons, text boxes, list boxes, etc.)), VBA modules, procedures, etc.

Properties: Think of the verb to be. Objects have properties that you can change.

Methods: Think of the verb to do. You might want an object to close, to open, etc.

Events: For a procedure to be executed, an event must happen. One event that everybody knows is the click of the button. Other events are the opening a workbook, the activating a sheet. So, you have to tell the computer when to execute a procedure.

Example:

Sub Command125_Click ()
Range("A2").Value= 2
Application.Close
End Sub

The "Sub" is the procedure; "Command125_Click" is the event; "Range ("A2")" and "Application" are objects; "Value" is a property" and "Close" is a method.

This procedure says that when the user clicks on the command button 125, the cell A2 takes a value of 2 and Excel is closed.

As you will discover in this Web site, you don't have to write much code, the Macro Recorder does the work for you.

http://codeprogrammer.blogspot.com

No comments: