AutoOpen and AutoSave Macro

When you open the Word document, the AutoOpen macro runs automatically.

The AutoOpen macro does two things:

It starts the auto-save macro (AutoSave).

It displays a message box to inform you that the automatic saving macro has started.

The AutoSave macro is responsible for saving the document every five minutes. It uses a static variable to remember the next scheduled save time and whether it is running for the first time. On the first run, it schedules the next save for five minutes later. On every subsequent run, it saves the document and then schedules itself to run again in another five minutes. This scheduling is handled by the Application.OnTime method, which tells to execute the macro again at the specified time.

This cycle continues as long as the document remains open. The macro ensures that your document is saved automatically every five minutes, reducing the risk of data loss if you forget to save manually.

Summary:

The macro starts automatically when you open the document (thanks to the AutoOpen macro)1.

It displays a notification that auto-saving has started.

It saves the document every five minutes by rescheduling itself.

This process continues until you close the document or Word.