AutoOpen Macro does not work after calling VBAProject.Clone using C#

Before upgrading to Aspose Word 19.7, we had c# code generating a Word document from mail merge, copying macros from another Word document using OpenXML
and on opening in the document in Word the “AutoOpen” macro is executed.

With the latest upgrades 20.1, we decided to make use of the VBAProject APIs and are using the Clone() methods.
The macros are copied correctly to the final document but unfortunately the AutoOpen macro does not get called on opening the document in Word. You have to run the macro manually.

I have also tried adding Document_Open event to call the AutoOpen macro but it still does not get executed.

In both cases, the final documents are saved as *.doc (Word 97-2003 Document), although I have also tried *.docm

I can supply both documents for you to compare what the differences are internally.

Are there any known issues regarding calling AutoOpen ?

Thanks

Paul

@pchung

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 attach the expected output Word file that shows the desired behavior.
  • 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.

AutoOpenIssue.zip (7.3 MB)

Attached is a zip containing a standalone app to generate a word document by copying macros from another template document.
One method uses OpenXML and the other Aspose VBAProject Clone method.

Included also in the debug folder are 2 sample word documents for you to compare: GeneratedWordDocUsingOpenXML.doc and GeneratedWordDocUsingClone.doc
When the first is opened in Word, the AutoOpen macro is triggered. The latter Word document fails to trigger.

Problem occurs for both 32bit and 64bit Word. However, for 32bit, you cannot see the macro source at all when opened in Word.

Please can you review the source code and compare the sample documents and identify what is wrong with the second document.
Is it something I’m missing out or could there be something missing the the clone method.

Thanks

Paul Chung

@pchung

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-20018. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi,
I see that the status of the WORDSNET-20018 has been closed. Does that mean its not a problem or it has been fixed and will be in the next Word .net update (20.3) ?
Regards
Paul

@pchung

Yes, this issue has been resolved and its fix will be available in the next version of Aspose.Words i.e. 20.3. We will inform you via this forum thread once next version of Aspose.Words is available.

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

I have integrated Aspose Word .net 20.3 and is working as expected now.
Thanks for your help.