In Aspose Word, not able to remove Vba module from Vba project (using VbaProject.Modules.Remove function)

We have a specific requirement where we need to remove few vba modules from vba project but when trying using aspose words we not able to remove the module from Vba. following is sample code for the same.

using (MemoryStream memoryStream = new MemoryStream(fileName, true))
{

    Document _doc = new Document(memoryStream);
    VbaProject vba = _doc.VbaProject.Clone();

    //_doc.VbaProject = new VbaProject();
    foreach (VbaModule vbaModule in vba.Modules)
    {
        if (vbaModule.Name.ToLower().Contains("custom"))
        {
            if (vbaModule.Type == VbaModuleType.ProceduralModule || vbaModule.Type == VbaModuleType.ClassModule)
            {
                VbaModule mod = _doc.VbaProject.Modules[vbaModule.Name];
                _doc.VbaProject.Modules.Remove(mod);
            }
        }
    }
}

Attached are the sample template and expected and actual response of the code when saved.
Sample-2.zip (41.1 KB)

Thanks

@ajit.v.surana

We have tested the scenario and 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-22547. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Is the issue resolved I can see the status is closed WORDSNET- 22547 ---- Status : Closed

@ajit.v.surana

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

The issues you have found earlier (filed as WORDSNET-22547) have been fixed in this Aspose.Words for .NET 21.9 update.