Chapter 20 · 20.8
Using macros safely: macros settings, autostart for colleagues and reuse
A macro can turn an entire worksheet upside down in one click. That's handy when you write it yourself, and a reason to be careful when you receive a file from someone else. This article covers what a macro in Euro-Office can and cannot do, how to set whether macros may run, what your colleagues see and how to use a macro in more than one file.
What a macro can and cannot do
- A macro lives in the file and only works in that file. It can read, change and delete anything in that file.
- A macro cannot open other files in your WebOké Nextcloud, and it cannot reach the files on your computer.
- Fetching something from the internet didn't work in our test: a macro that tried to read a web page got an error and did nothing else.
- A macro runs in your browser while you have the document open. If you close the document, a macro that watches for changes stops too.
The prompt when opening a file
If a file contains a macro with Autostart (see Automatisch datum en tijd invullen zodra iemand een cel wijzigt), Euro-Office asks when you open it: The file contains automatic macros. Do you want to run macros?

- Yes: the macros with autostart run.
- No: the file opens as normal, but the macros don't start. You can read and edit everything.
- Remember my choice for all files: Euro-Office stops asking and always makes the same choice from then on. Only tick this if you're sure you want that; you can change it back in the macros settings below.
Only choose Yes if you know where the file comes from. Not sure? Choose No, open View, Macros and first read what the macro does. A macro that only adds a timestamp or formatting is harmless; a macro that deletes rows or fetches something from the internet is one you'll want to understand first.
The macros settings
Click File, Advanced settings and look under Macros settings (1). There are three options:

| Option | What happens |
|---|---|
| Show notification (default) | Automatic macros don't start by themselves; you get the prompt above. Recommended. |
| Enable all | Automatic macros start without asking. Only use this if you work exclusively with your own files. |
| Disable all | Automatic macros never start and you don't get a notification. |
This setting applies to you, not to the file. Each colleague has their own setting.
Autostart for colleagues
If you share a file containing a macro with autostart, every colleague gets the same prompt when opening it. So the timestamp from Automatisch datum en tijd invullen zodra iemand een cel wijzigt only works for a colleague if they choose Yes. Agree on this together, and add a short explanation in the file, for example in a cell above the table: "Choose Yes when opening, otherwise no timestamp is added."
A macro without autostart, which you start with Run or a button (as in Een rij automatisch naar een archiefblad verplaatsen als de status Klaar is and A button in your spreadsheet that runs a macro), doesn't trigger a prompt when the file opens. It only runs when someone starts it.
Using a macro in more than one file
A macro belongs to one file. (Custom functions are the exception: they belong to you as a user, see Excel-formules met LET of LAMBDA: wat je in Euro-Office in plaats daarvan doet.) A "Personal Macro Workbook" like in Excel, with macros for all your files, doesn't exist in Euro-Office. Here are two ways to reuse your macros anyway:
- A template file. Create a file with the right worksheets and macros, for example "Orderlijst sjabloon.xlsx". For each new year or each new customer, copy that file in your WebOké Nextcloud. The macros come along.
- Copying the code. In one file, open View, Macros, select the code with Ctrl+A and copy it. In the other file, create a new macro and paste the code. Also keep your best macros in a text file in your Nextcloud, so you can always find them again.
Downloading and opening in Excel or Word
Your macros are stored in the xlsx or docx file itself: after closing and reopening, they're still there. Excel and Word don't recognise these JavaScript macros and won't run them. If a file also needs to work in Excel, make sure it stays usable without the macro.
Pitfalls
- Ticked "Remember my choice for all files" by accident? Go to Macros settings and set it back to Show notification.
- A macro that deletes everything can affect everyone in a shared file too. Use the version history to restore the file (see Version History: restoring an older version).
- Don't copy code from unknown websites without understanding what it does. A line such as Delete or Clear removes data.
For the administrator: at WebOké, macros are enabled for everyone. There are deliberately no plugins (see Plugins in Euro-Office: why WebOké doesn't offer them and what to do instead): that's why the buttons under the magic wand in the Macros window (such as Convert from VBA) are greyed out.
