Hello,
The method available to work with macros is addMacroFromDoc (https://www.phpdocx.com/api-documentation/layout-and-general/import-macro-Word-document-with-PHP). On the previous page and the package you can find a sample to illustrate how to use it.
Regards.