Macros are like an additional arm Macros are little applications inside Word that allow us automate mechanical activities like replacements, formatting, adding text that is constantly repeated, and sharing data with Excel, among other things. Almost everything repetitious that comes to mind can be solved by a macro; the issue is how much time you have to devote to developing a programme that accomplishes it.
The alignment of footnotes according to what ABNT gives is an example of something difficult if done manually, but that can be accomplished in a flash using a macro. The note number must always be highlighted from the rest of the text, according to the standard:
“Footnotes may comply to 7.1 and 7.2 and must be aligned from the second line of the same footnote, below the first letter of the first word, to emphasise the exponent, with no space between them, and in a smaller font” (NBR 10520).
This is not something that Word performs automatically. It is important to go to the paragraph settings for each note and adjust the displacement indentation.
There is also the option of using styles. However, at least three would be required for the alignment to be correct: grades 1 to 9, 10 to 99, 100 to 999, and so on. Working with styles entails picking text and applying it in at least three phases.
This is already possible with automation code and may be completed with a single click. Of course, in order to get there, you must first write the macro such that it performs the desired function.
Anatomy of a Macro for Microsoft Office
Macros are like an additional arm Macros are written in Visual Basic for Applications, an Office-specific language (VBA). VBA was introduced with Excel 5 in 1993. The language was created as a solution to standardise and make official the add-ons that previously existed in numerous different languages to compensate for the program’s flaws.
The most intriguing aspect of this language is that it is possible to understand a bit of its functioning while building macros using the recording feature in Word.
However, “programming” using the interface is relatively restricted — mostly through search and replace. Many key logic steps for more advanced tools are missing, such as “if…then” conditional expressions (if condition x is true, then do y) or “for each…next” looping structures (do z for each x in group y).
For starters, VBA code always begins with ” Sub macroname() ” and concludes with ” End Sub “. If you copy code without include the beginning and end lines, the application will fail.
Also, the green lines that begin with’are comments, which means the software does not perceive them as commands.
Where macros are “stored”
Macros are like an additional arm By default, macros pasted in modules inside the Normal file are stored in a file with the same name, which also includes all of your Word installation’s setup settings. Normal is a Word template (Normal.dotm) in which this data is kept.
One or more macros may be housed in a module. You may put all of your macros in one module if you like, but this makes it harder to identify particular code. Another possibility is to organise macros into theme modules. Finally, each macro may be put into a distinct module, allowing the locations of each one to be easily identified.
These are the fundamentals, so you can get code taken from a reliable source to work. If you want to go further into this area, I suggest beginning with the language documentation available in the Microsoft repository.
Is VBA the only language in which you can create macros for Word?
Are macros advantageous?
Macros are like an additional arm, Yes, they are, in my opinion. I use many of these every day, ranging from a basic tool that inserts a period and immediately displays the next word box to more complicated routines, as seen in the video above. Only you can tell if macros will make your life simpler.