VBA Theory

Embed Size (px)

Citation preview

  • 7/26/2019 VBA Theory

    1/8

    VBA Visual Basic for Applications

    IDE Integrated Development Environment

    File Extension Macro Enabled Workbook

    i Procedural Programming

    iiOOP - Object Oriented Programming

    iiiOBP - Object Based Programming

    SDLC Software Development Life Cycle

    i Problem Denition

    ii Feasibilit !tud and "e#uirements $at%erin

    iii Design

    iv&oding

    v'esting

    vi &ontroling

    vii Maintenance

    Data Type Denes t%e tpe ( si)e of t%e data being st

    i Primary

    a* +umeric

    b* Date

    c* !tring

    ii Secondary

    a* Variant , used -%en t%e data tpe stored

    b* .b/ect , a pointer -%ic% stores t%e locatio

    Operators A smbol0p%rase used to perform operations

    i Aritmetic

    ii!elational

    iii

    ivOter

    "ogical

  • 7/26/2019 VBA Theory

    2/8

    CLASS

    OBJECT

    1*2lsm

    Property

    &3 etc Method

    &443 5AVA3 etc Event

    *+E'3 VBA3 etcModle

    i

    g ii

    iii

    !aria"le

    Scope #ali$er red in t%e variable i

    ii

    Float3 Integer3 Bte etc* iii

    6 btes iv

    Fi2ed lengt%3 Variable lengt%

    in t%e variable could var at runtime

    n of %e ob/ect pointed in t%e "AM

    of a specic nature on one or more operands

    4 , 1 0 7 Mod

    8 9: 9 : 98 :8

    A+D ." +.' ;."

    8 3 < = > (

  • 7/26/2019 VBA Theory

    3/8

    Data and t%e code -%ic% manipulates t%e data

    &lass is implemented and I+!'A+&E of class is created

    Denes t%e appearance and be%aviour of t%e ob/ect

    Interface t%roug% -%ic% an ob/ect is issued a command to perform an action

    .ccurance of certain action on t%e ob/ect

    A set of variables and0or constants and0or procedures

    All VBA coding is done in modules

    !tandard Module =*bas>

    Form Module =*frm>

    &lass Module =*cls>

    A named location in t%e computer

  • 7/26/2019 VBA Theory

    4/8

    Active .b/ects of E2cel VBA@ Application

    !election Active&ell !ession

    C Active!%eet

    ActiveWindo- Workbook

    Active&%art ActiveWorkbook Works%eet

    G ActivePrinter "ange

    &ell

  • 7/26/2019 VBA Theory

    5/8

    application

    2

  • 7/26/2019 VBA Theory

    6/8

  • 7/26/2019 VBA Theory

    7/8

    Procedure Syntax

    Variable Declaration 9scope #ualier: 9var* name: HAs 9data tpe: 9:

    H

  • 7/26/2019 VBA Theory

    8/8

    !ules Exam#le

    Compulsory component Dim x as Integer

    Optional component Private abc as String

    Dim abc as String*50

    Public myVar_01 as Variant

    Static stc as Static