Macro Throws Exception after Updating DOTM using .NET

Hi,

I have an application that takes an existing document template with macros (.dotm) and updates some of the code and then resaves the template as a new dotm file.

However when this template is used to create a new document, the macros fail to run throwing an “Unknown error 32809”.

If I open the template in Word and view the macro code, all is in order, and if I resave the macros (by making a change to a comment line only), the template now works fine.

I tried removing my code that manipulated the macros, so effectively opening a dotm generated in Word and then saving it back under a new name using Aspose.Words, and the same problem occurs.

I am using Aspose.Words 20.11.0 from the Aspose.Total for .NET package.
The original dotm was created in the latest Microsoft 365 Word (Version 2012 Build 13530.20316)

If anyone can assist me with this, I would be very grateful.

Thanks,
Nikolaus

@NikolausM

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please share the macro name that is throwing the error.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

This appears to be an issue with the manner in which the file was received.

When received via an Email it is marked as from coming from a separate machine and is blocked.

The DOTM that exhibited the issue of not running the Macros was in fact received via email. Right clicking the downloaded file and selecting Unblock resolved the issue.

Interestingly, the same file downloaded from a web page link has no such problem (at least at this time).

Thanks

@NikolausM

It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.