Macros
File extensions supporting Macros in 2022: DOCM, DOTM DOCX.
DOCM is one of the best bet for a successful macro execution. DOCM files containing macros can be renamed as other file formats by chaining their file extension. For instance DOCM files can be renamed to a RTF and it will still be capable of macro execution.
DOCX files can be used to execute macros through the abuse of remote templates. DOCX files that reference a template can execute macros.
Creation:
Click on View --> Macros

Macros in (Document Name) --> Create

Write your Macro, the document_open() and AutoOpen() functions are there to help the macro auto trigger on document load. The default vbHide value will prevent the cmd.exe processes from being visible to the end user.
Hit the save key and save it as a 97-2003 word document

The cmd processes can be viewed using tools such as Task Manager or Process Explorer. On examination it appears that cmd is being treated as Microsoft Word's child processes. This is why it's important to migrate to a more stable processes as currently cmd.exe will close when the user exits the document.

Last updated
Was this helpful?