Supercharging Your Day-to-Day Work

M is for Macros

M is for Macros - Supercharging Your Day-to-Day Work

There are handy add-ons when it comes to reducing the daily workload and to streamlining the user’s own handling of MS Office: Macros . With this article we explain the right way to activate and use MS Office macros. The examples shown here were implemented in MS Word. But once you have grasped the concept, you will be able to automate frequently used tasks in Excel or PowerPoint and complete your tasks that little bit faster than before.

Macros can be programmed in Visual Basic for Applications (VBA) or recorded in the individual programs themselves. Here we will use the example of a document header to briefly outline both options.

1. Enabling Macros

Macros are nothing other than program codes and can therefore present a vulnerability. That’s why all macros are disabled in the default setting. They need to be enabled in order to define automatic tasks.

First go to File > Options > Customize Ribbon and select the tab Developer. You will now see a new tab with the same name in the program window. On the right of this menu, you will see the column Code and the button Macro Security. You will be able to create and use your own macros if you now select the button Disable all macros except digitally signed macros in this menu. Read more

2. Recording Macros

Select the option Developer > Record Macro to record an activity in a new blank document. Assign a name to your macro and then click on Button to insert a button in your menu. It’s used to access the macro. In the next window you must check Normal.NewMacros"YourMacroName", click on Add to insert it into the bar and then on Modify to give the macro a button with which it is retrieved. Finally, click on OK to confirm. Read more

A good example of a macro

All of the following activities are then recorded.

The idea is to create a document header within 4 steps:

  1. You want to integrate the company logo left-justified in the header.
  2. Below that you want to show your own name, address and contact information.
  3. On the right you want placeholders for the recipient, the address and the company.
  4. Finally you want to insert the current date above the letter itself.

Once you have created the content, click on the button "Stop Recording". Well done, you have just created your own macro. You can run the macro as often as you like by clicking on the selected button in the upper menu bar.

3. Customizing macros

If you want the macro to be available for any number of users, the name in the address will have to change, depending on the particular person. You can edit the macro in Visual Basic for Applications to make that kind of change. To open the menu, go to Macros > YourMacroName > Edit. This window displays the code for the macro you recorded. The code contains the line Selection.TypeText Text="…" with the name that was entered during recording.

If you want to be able to insert the respective name of any given user at this point, you will need to replace the name and the inverted commas with the entry Environ(“USERNAME“). In most cases, user names will not contain any spaces. Often they are replaced with a period or something similar, e.g. “John.Doe”.

To reinsert a space instead of the separating character, enter the following code in the line below Selection.TypeText :

With Selection.Find

.Text = "."
.Replacement.Text = " "
.Execute Replace:=wdReplaceAll, Forward:=True, _

End With

Save the changes and then start using the macro. Your name should now appear automatically at the designated position. It’s worth reading the rest of the code. Visual Basic for Applications is easy to understand. You may even be able to tidy up the code for your macro if you corrected yourself during recording. Read more

VBA and macros in MS Office allow you to streamline the workflow to perfection and therefore to save time and nerves. By the way, you can also share your macros with other people. You will find the function in VBA under File > Export File.

Need help with Office?

Get in touch with our Office 365 experts.

Read more
  • User Productivity
  • Office, Microsoft, Tips

Skomentuj ten artykuł

Zostaw komentarz, aby dać nam znać, co myślisz o tym temacie!

Zostaw komentarz


Zespół Redakcyjny Bloga

Trend Scouts

IT Trends and industry-relevant novelties

Related Articles

  • 30 listopada 2020
  • Cezary Anisko
  • User Productivity
  • Managed Service, 365Simple, Licensing, Office, Support

Unified Support dla 365

Z usługą SoftwareONE Unified Support dla 365 możesz łatwo zoptymalizować wydatki w chmurze. Nie trać środków na niezużyte licencje, w pełni wykorzystaj potencjał Twojej organizacji w chmurze z Office365.

  • 22 października 2020
  • Cezary Anisko
  • User Productivity
  • 365Simple, Support, Managed Service, Office


Z usługą SoftwareONE 365Simple możesz łatwo zoptymalizować wydatki w chmurze. Nie trać środków na niezużyte licencje, w pełni wykorzystaj potencjał Twojej organizacji w chmurze z Office365.

  • 24 marca 2020
  • Zespół Redakcyjny Bloga
  • User Productivity
  • Azure, SharePoint

SharePoint on Azure: The Right Choice For Your Business?

Is SharePoint on Microsoft Azure the right choice for your business? We help you to decide.