Table of contents
- VBA – Visual Basic for Applications
- What is the purpose of VBA and is it useful to learn it?
- VBA’s strengths?
- What about the weak points?
- Some Tips about VBA language
- Where to start…?
*Click images to enlarge
1. VBA – Visual Basic for Applications
VBA – Visual Basic for Applications is a scripting language that is used in particular in the applications of the office suite of Microsoft, the Microsoft Office (Excel, Word, Access, Outlook, and PowerPoint).
For more information about the history of VBA, you can check this page on VBA in Wikipedia.
Here we gonna answer some basic questions about VBA like what the purpose of this programming language? Is It worth and easy to learn it? and same as other programming languages what are the VBA’s strengths and its weaknesses.
2. What is the purpose of VBA and is it useful to learn it?
VBA is used to automate tasks in the different applications of the Office suite called Macros (you want to know more about macros in Excel check this Excel tutorial Macros in Excel with VBA code examples. However we can use VBA in many other ways like:
- copy tables, formulas, formats, … in your Excel workbooks.
- open, save, archive, … your Excel, Word files, …
- Send emails (Outlook), sort slides in random order (PowerPoint),…
- update pivot tables, create graphs, create depreciation tables, …
- monitor user activity (create logs)
- manage user rights – define which (group of) user(s) can do what in an Excel workbook for example)
- create your own functions that can be used in Excel itself
In addition, VBA can also be used outside the Microsoft Office suite. For examples:
- create, rename, delete files of any type
- open any file and any application in Windows
- automatically download files from the internet
- change the size of your photos (.jpg)
- archive your files with Zip (compression, decompression,…)
- … and much more than that!
VBA can also save you a lot of time and make your life much easier and compared to the other language VBA is very easy to learn.
3. VBA’s strengths?
- Easy installation: apart from Excel you don’t need anything else to get started. The code (macros) can be developed and executed directly in Excel.
- Easy to use: as well as the installation
- Easy-to-read code: By reading the code itself, you can understand what it is supposed to do.
- Quick learning: from a syntactical point of view, it is a rather simple language
- Interaction between Office applications: VBA is a language that is used in all the applications of the Office suite and also in the web browser.
- And much more…
4. What about the weak points?
Just like everywhere else, VBA also has its limitations:
- Sequential processing: in VBA, you cannot run several processes in parallel.
- It’s not really a programming language: it’s a scripting language
- Limited graphical interfaces: Indeed, it is not in VBA that you will develop video games or beautiful “apps” :D.
5. Some Tips about VBA language
- Most programming languages use the same set of fundamental instructions: the assignment instruction, the input and output instructions, the conditional instruction, and the iterative instruction. The VBA language implements these five instructions too with its own syntax.
- Every program written in VBA is defined with the keywords of the language and is structured in two parts: the variable declaration part and the instruction part. The instructions are written on one or more lines. If the code requires several lines, it ends with a term that marks the end of the instruction.
- Editing and running a VBA program is done using the VBE editor (Visual Basic Editor), which is an integral part of Excel.
- When running the first program, we recommend that you choose the option “Mandatory variable declaration” as this leads to more readable and secure programming.
6. Where to start…?
To introduce you with the VBA language, you can start by creating simple Macros in Excel. You can check posts here in our blogs and we recommended that you start with learning the Excel basics A brief introduction to Macros in Excel