Wednesday, 13 August 2014

VBA and its features -

What VBA Can do?

My earlier blog described about VBA and its capabilities. This blog is focused upon 'Features of VBA and usage'?

VBA is used for writing Macros to Automate Labor-Intensive and Repetitive Tasks and to bring efficiency and 100% accuracy by eliminating manual tasks.

VBA creates User-Defined Functions and sub routines to Achieve Complicated Functionalities. Subroutines are independent entities and never return a value while functions does. A function cannot change the value of the actual argument.

VBA creates Standard Windows Menu/Tool Bars for Interface

VBA can take I/O with External Files. VBA can also perform Database Operations applications like MySQL, Exce., Access etc.

VBA is an object oriented language and has separate object models for different entities. What is an object? 

An Object is an entity or a body such as Worksheet, Workbook, Range, Cell, Chart, Name, etc. which has properties like quantity, name, type. A Group of Similar Objects Share Common Properties, Methods and Events. 
Some Examples are : - 

  1. Worksheets("Sheet1") is an Object Referring to the Sheet 1.
  2. Range("A1:AZ500") is an Object Referring to a Range starting from A1 till AZ500.
  3. Cells(1,1) or Range(“A1”) is an Object Referring to Range “A1”


A property of an object refers to its physical characteristics say quantity, color, type. Examples - 
  1. Worksheets.Count (Read Only)
  2. Worksheets.Visible = True (Read and Write)

A method of an object refers to the action it performs on a certain event.
Examples
   1. Worksheets.Close
   2. Worksheets.Save
   3. Worksheets.Add
   4. Worksheets.Delete

An event refers to the action performed by the object on that event which may be mouse click or on workbook.save etc. Example - Mouse click, Button click, Mouse Hover etc.




  • The basic hierarchy of VBA Excel Object Model -

  • The basic hierarchy of VBA Word Object Model -



  • The basic hierarchy of VBA Access Object Model -



 
to be continued............

No comments:

Post a Comment