VBA (Visual Basic for Applications) Interview Preparation Guide
Download PDF

VBA Frequently Asked Questions in various VBA (Visual Basic for Applications) Interviews asked by the interviewer. So learn VBA with the help of this VBA (Visual Basic for Applications) Interview questions and answers guide and feel free to comment as your suggestions, questions and answers on any VBA (Visual Basic for Applications) Interview Question or answer by the comment feature available on the page.

39 VBA Questions and Answers:

1 :: Explain What are the ADO objects?

The ADO objects are:

Command
Connection
Error
Field
Parameter
Property
Record
RecordSet
Stream

Connection: Used to make a connection between your app and an external data source, i.e., sql server. Command: Used to build queries, including user-specific parameters, to access records from a data source (which are returned in a Recordset) Recordset: Used to access records returned from an SQL query. With a recordset, you can navigate returned records. You can also add, modify or delete records.

2 :: Explain the difference between Msgbox Statement and MsgboxQ function?

MsgBox is a built in VB function which displays a Message Box and MsgBoxQ is a function defined by the user.

3 :: Explain Which controls can not be placed in MDI?

The Controls which do not have Align property can't be placed on MDI Form.

E.g., Picturebox only has Align property in Standard Components of VB other controls dont have align property an hence can't be drawn on MDI Form.

Timer control can also be placed on MDI form.

4 :: Explain the difference between visual basic, VB script and visual basic applications?

Visual basic is useful if you are planning to develop your programs from scratch. This language helps you in developing Active x controls, exe files, etc.

Visual script is a powerful tool, through which you can create small scale applications on web pages, automation applications, etc. Integrated development environment is not present for VB script.
Visual basic applications are very useful in automating your existing application. VB application is useful for developing already existing applications.

5 :: How to format expressions by using VBA?

Format functions can be used to format many of the expressions such as currency, time, date, percentages and numbers. These functions are much simpler to use in VBA. User defined date, numeric and string formats are present in many of the applications.

6 :: What is insert module and Goal Seek functions present in VBA?

The chief use of VBA is to make use of its special function which helps in repeated actions. Goal seek function helps to reduce manual entry of the code each and every time. This solves the problem of repeated function entry by automating functions and actions. Sub routines are inserted into the using the VBA editor and command insert module.

7 :: Explain four different cursor and locking types in ADO and describe them briefly?

Cursor types:1. Forwardonly, 2. Static, 3. Keyset 4. Dyanmic

Lock types : 1. lockpessimistic, 2. lockoptimistic,3. lockbatchoptimistic 4. lockreadonly

8 :: Explain Which controls have refresh method, clear method?

Datagrid,listbox,combobox,label,button have refresh methodand textbox has clear methodalmost all controls have refresh method

9 :: What is pointers function?

Visual basic applications have very rich and flexible applications but there is one limitation when using pointer function. Windows API has limited support for function pointers because it has the ability to use but not the functional support to call back the function. But later versions have support for modules. Function pointers have inbuilt support (DLL`s) for call but not for call back.

10 :: What is line option explicit?

Line explicit function makes the compiler to identify all the variables which are not specified by the dim statement. This command significantly reduces the problem of type errors. This is used extensively because VBA deals with information rich applications in which type errors are common.