Wednesday, June 19, 2013

What is VBA

Leave a Comment
Understanding VBA
Visual Basic is a programming language – a language for writing instructions that a computer can read and process. VBA is a programming language that is specially designed to work with the application program in Microsoft Office including Word, Excel, Power Point, Outlooks and of course, Access.

When you write text in a programming language as opposed to write in plain English, you are writing Code.  Programmers use the term Code to refer to anything that is written in a computer programming language. The whole trick to mastering VBA is finding out what all the various words in the language so that you can write the Code that tell Word, Excel, Power Point, Outlooks, and Access to perform a task.
VBA Sample Code


Public Function PCase(anyText)
    'Custom VBA function to fix all uppercase Letters
   
    PCase = StrConv(anyText, vbProperCase)
   
    IfLeft(PCase, 4) = "P.o." Then
        PCase = "P.O." & Mid(PCase, 5)
    End If
   
    IfLeft(PCase, 2) = "Mc" Then
        PCase = "Mc" & UCase(Mid(PCase, 3, 1)) & Mid(PCase, 4)
    End If
       
    IfLeft(PCase, 3) = "Mac" Then
        PCase = "Mac" & UCase(Mid(PCase, 4, 1)) & Mid(PCase, 5)
    End If
   
End Function

This is only the example to show the sample of VBA code. In the next article we will go to the depth of what VBA is in the Microsoft office.

That is all for the introduction to VBA.

0 comments :

Post a Comment