You are on page 1of 4

Jenerose D.

Aison
BSA-4
Auditing in the IT Environment
1. What is Visual Basic for Application?

Visual Basic for Applications is a programming that is similar to Visual Basic, only it is
embedded in an individual Microsoft application such as Excel or Access. Using VBA you can
create macros or small programs that perform tasks within the Microsoft application.

2. What is Macros?

A symbol, name, or key that represents a list of commands, actions, or keystrokes.


Many programs allow you to create macros so that you can enter a single character or word to
perform a whole series of actions. Suppose, for example, that you are editing a file and want to
indent every third line five spaces.
3. What is Script?
A script or scripting language is a computer language with a series of commands within a file
that is capable of being executed without being compiled. Good examples of server languages
include Perl, PHP, and Python. The best example of a client side scripting language is JavaScript.
A full list of scripting languages and other programming languages can be found through
our programming language definition,
4. How to enable Macros?
Enable macros when the Message Bar appears
When you open a file that has macros, the yellow message bar appears with a shield icon and
the Enable Content button. If you know the macro, or macros, are from a reliable source, use
the following instructions:
On the Message Bar, click Enable Content.
The file opens and is a trusted document.
The following image is an example of the Message Bar when macros are in the file.
Enable macros in the Backstage view
Another method to enable macros in a file is via the Microsoft Office Backstage view, the view
that appears after you click the File tab, when the yellow Message Bar appears.
Click the File tab.
In the Security Warning area, click Enable Content.
Under Enable All Content, click always enable this document's active content.
The file becomes a trusted document.
The following image is an example of the Enable Content options.

Enable macros for one time when the Security Warning appears
Use the following instructions to enable macros for the duration that the file is open. When you
close the file, and then reopen it, the warning appears again.
Click the File tab.
In the Security Warning area, click Enable Content.
Select Advanced Options.
In the Microsoft Office Security Options dialog box, click Enable content for this
session for each macro.

Click OK.
Change macro settings in the Trust Center
Macro settings are located in the Trust Center. However, if you work in an organization, the
system administrator might have changed the default settings to prevent anyone from
changing settings.
IMPORTANT When you change your macro settings in the Trust Center, they are changed
only for the Office program that you are currently using. The macro settings are not changed
for all your Office programs.
Click the File tab.
Click Options.
Click Trust Center, and then click Trust Center Settings.
In the Trust Center, click Macro Settings.
Make the selections that you want.
Click OK.
The following image is the Macro Settings area of the Trust Center.

5. How to set password for Macros?


Place a command button on your worksheet and add the following code lines:
Place a command button on your worksheet and add the following code lines:
1. First, create a simple macro that you want to protect.
Range("A1").Value = "This is secret code"
2. Next, click Tools, VBAProject Properties...

3. On the Protection tab, check "Lock project for viewing" and enter a password twice.

4. Click OK.
5. Save, close and reopen

the Excel file. Try to view the code.

The following dialog box will appear:

You can still execute the code by clicking on the command button but you cannot view or edit the code anymore
(unless you know the password). The password for the downloadable Excel file is "easy".
6. If you want to password protect the macro from being executed, add the following code lines:
Dim password As Variant
password = Application.InputBox("Enter Password", "Password Protected")
Select Case password
Case Is = False
'do nothing
Case Is = "easy"
Range("A1").Value = "This is secret code"
Case Else
MsgBox "Incorrect Password"
End Select
Result when you click the command button on the sheet:

Explanation: The macro uses the InputBox method of the Application object. If the users clicks Cancel, this
method returns False and nothing happens (InputBox disappears). Only when the user knows the password
("easy" again), the secret code will be executed. If the entered password is incorrect, a MsgBox is displayed.

Note that the user cannot take a look at the password in the Visual Basic Editor because the project is protected
from being viewed.

You might also like