How to access macros from the document using .NET

Hi,

I am evaluating Aspose Words as a reporting solution for a product I am developing and been pretty impressed… but there is one critical feature I need, and that is to being able to read the macros associated with the word document. The reason is that I am importing word documents that contain docvariables that need to be converted to values. These docvariables are linked to simple Word macros that I need to get access to from Aspose so that I can myself interpret them.

All it would take is a simple get property like -> document.Macros that would return all the macros in the document as text. You are already conserving the macros between loads and saves so you have access to them. All you need to do is add “document.Macros” in the next release and you can consider me a happy customer.

thanks.

Hi

Thanks for your request. I logged your request in our defect tracking system. We will consider adding the requested feature.
Maybe in your case, you can just read DocVariables from the document:
https://reference.aspose.com/words/net/aspose.words/document/variables/
Best regards.

Hi,

I know how to get variables, but I need also to be able to parse myself the macros associated with the word document. So I need to be able to access the macros. I searched your forums and saw a similar request from other users.

Do you have any information on how to retrieve the macros directly from the word document?

thanks.

Hi there,
Thanks for your request. Unfortunately there is no way to acheive this at the moment using Aspose.Words. We will look into providing this feature sometime in the future. We will keep you informed when it becomes avaliable.
Thanks,

The issues you have found earlier (filed as WORDSNET-3714) have been fixed in this Aspose.Words for .NET 19.6 update and this Aspose.Words for Java 19.6 update.

@MrApnea

With the latest version of Aspose.Words for .NET 20.5, you can read and write macros from/to the document. Please read the following article about working with VBA macros. .
Working with VBA Macros