1. Explain what is VBA or Visual Basic for Applications?
VBA stands for Visual Basic for Applications; it is an event driven programming language developed by Microsoft. It is predominantly used with Microsoft office applications like MS-word, MS-Access, and MS-Excel.2. Mention where you can write your VBA program for Macro?
Module is the place where you can write VBA program for Macro, to insert a Module navigate to Insert -> Module3. Mention what are the comments style used in VBA?
Comments are used to document the program logic and the user information with which other programmers can work seamlessly on the same code in future. There are mainly two methods in VBA to represent comments. Any statement that begins with a single quote is treated as comment Or you can use statement REM instead of single quotation mark (‘)4. In VBA how we can declare variable and constant?
In VBA, variable can be declared with the keyword “DIM” while constant is declared with keyword “Const.”5. Explain what is ADO, ODBC and OLEDB?
ADO: ActiveX Data Objects or ADO is a universal data access framework that encompasses the functionality of DAOODBC: Open Database Connectivity or ODBC is a technology that enables a database client application connect to an external database
OLEDB: It is a low-level programming interface designed to access a wide change of data access object linking and embedding (OLE)
6. Explain about function pointers in VBA?
The VBA (Visual Basic Information) have flexible applications, but there is a limitation to a function pointer in VBA. Windows API has inadequate support for function pointers because it has the ability to use the function but not the functional support to call back the function. It has inbuilt support for the call but not for a callback.7. Explain how “reference counting” in VBA is done?
In VBA, soon a variable goes out of scope, the reference counter on the reference object is decremented. When you assign the object reference to another variable, the reference counter is incremented. While when your reference count reaches to zero it terminates the event.8. How can you decrease the reference counter explicitly?
To decrease the reference counter explicitly, you need to set a variable to “Nothing”.9. Explain what is COM (Component Object Model) objects in VBA?
COM objects are usually .dll files, and are compiled executable programs.10. Explain how can you dial a phone number through VBA?
In order to dial a phone number through VBA, you need to follow the following steps11. Explain what is the meaning of “Option Explicit”? Where it should be used?
“Option Explicit” makes the declaration of variables mandatory. Line explicit function makes the compiler to control all the variables that are not declared by the dim statement. This command diminishes the problem of type errors considerably. It is used in VBA because it deals with information rich application in which type errors are common. Before starting any sub-procedures it can be used inside a module.12. Explain how can you pass arguments to VBA functions?
When arguments are passed to VBA functions, they can be passed in two waysByVal: When argument is passed by Value, then it means that only value is passed to the procedure, and any changes that are made to the argument inside the procedure will be lost when the procedure is exited
ByRef: When the argument is passed by reference than the actual address of the argument is passed to the procedure. Any changes that are made to the argument inside the procedure will be recalled when the procedure is exited
13. Mention the method that are called from the ObjectContext object to notify MTS that the transaction was unsuccessful or successful?
Setabort and setcomplete method are called from the ObjectContext object to notify MTS that the transaction was unsuccessful or unsuccessful14. What is the code to find a last used Row in a column or last used Column of a row?
To find the last row in a column, the command used is End(xlUp) and to find last column in a row, the command used is End(xlToLeft).15. Mention the difference between the Subroutines and Functions in VBA?
The difference between the Subroutines and Functions is that16. Explain what is the difference between CurrentRegion properties and UsedRange?
CurrentRegion: The current region is a range bounded by any combination of blank columns and rowsUsedRange: This property is used to select the range of used cells on a worksheet. It returns a Range object that represents the used range on the specific worksheet