Grade 12 Revision – What are macros?

Recording macros

What are Macros?
Often we use software to perform a set of operations many times. For example, to achieve a consistent, professional look in their documents, an organisation might add the company name, logo, and contact details to each document, and always format these using the same font, font size, and style. Manually repeating these actions on each document is tedious, time consuming, and prone error.

Macros can help because they let users record a series of operations and replay them all with the click of a button. In the above example, a user can start recording a macro, perform all the required text insertion and formatting operations, then save the macro. In future, running the macro will apply all the recorded operations at once.

Recording macros

Macros can record mouse clicks and keystrokes, or they can be written using a macro programming language, which is a bit more complex but offers greater control. Visual Basic for Applications (VBA), included with Microsoft Office, started out as a macro programming language.

Macros are not limited to word processors – they are used in a lot of software, including databases, spreadsheets, and text editors. Tasks can include:

  • Applying consistent formatting (as explained above)
  • Extracting information from a document (such as all email addresses or links)
  • Include text only under certain conditions (e.g. in a questionnaire, if a user selects “other” in response to “Where did you hear about our company”, a box can appear asking them to enter some text to explain their response.
  • Databases: Automatically perform actions (such as updating fields) on a set of records
  • Databases: Performing several operations when a button is clicked, such as opening a form, running a query, and finding a record.

The key point is that macros are used to record and replay a series of actions.

Security Concerns and Macro Viruses
Macros created by malicious users are known as macro viruses. Macro viruses take advantage of macro programming features to cause problems or spread malware. For example, a macro virus might randomly delete data from a document, rendering it useless. Some macro viruses go further and automatically download and installĀ  malware from the Internet with the user’s knowledge.

Macro viruses can spread themselves by embedding themselves in other documents or templates, and by emailing copies of infected documents to addresses in the user’s address book (this is what the famous Melissa macro virus did).

Macro viruses are usually configured to run automatically when a document is opened, without any interaction from the user. For this reason, it is a good idea to check your macro security settings and disable the option to automatically run them (this is usually the default setting now).

Macro settings

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.