mod6
mod6
Which of the following VBA windows shows the code of the active object?
A. Explorer Window
B. Properties window
C. Immediate window
D. Code window
5 marks
What are different types code modules available with VBE ? What is the difference between
procedure and function
Code Module: Default Modules which we use to write all procedures and functions
UserForms: UserForms helps to develop GUI (Graphical User Interface) applications.
Class Modules: Class module allows to create new objecs and define methods, properties
and events. Also, it will allow to enhance the existing objects.
Procedures or Subroutines will not return a value; functions will return values.
A macro is nothing but set of instructions which are stored in Visual Basic module in a VBA
Editor. It helps in automating common repetitive tasks on daily, weekly or monthly basis by
running macro. Using macros, we can save lot of time, increase productivity and on time
delivery to customers.
Q.What is VBA?What are datatypes and name some datatypes?What is variant datatype and
explain it?What are scope of variable?
Data types helps to declare Variables with specific data, this helps to VBA to know the
type of the data and assign the memory based on the DataType of the Variable.
1. Boolean
2. Byte
3. Currency
4. Date
5. Double
6. Integer
Variant data type is default data type and it can hold any type of data. This will allocate
maximum memory to hold the Varian Type. We use Variant data-type when we dot know the
type of the data or to accept the multiple data types in a single variable.
• Local Level: Variables which are defined with DIM statement in a procedure or
functions
• Module Level: Which are defined with DIM statement on top of a module, can
be accessed in entire module
• Global Level: Which are defined Public statement at top of any module, can
be accessed in entire project.
Please find the following steps to delete macros from the workbook.
Step 1: Go To Developer tab from the main ribbon of Excel window.
Step 2: Click on the Macros command button to see the available macros in the active
workbook.
Step 3: Once you click on the Macros command button, Macro dialog box will appear on the
screen.
Step 4: Select macro name which you want to delete macro and then click on ‘Delete’
command button.
Step 5: Now, It will show the confirmation dialog box. Click on Ok to delete the macro.
ByVal:
Specifies that an argument is passed in such a way that the called procedure or property
cannot change the value of a variable underlying the argument in the calling code.
ByRef:
Specifies that an argument is passed in such a way that the called procedure can change the
value of a variable underlying the argument in the calling code.
15 marks