VBA code setter?

Hi Aspose team,

great news that you extended Aspose.Words to be able to read VBA source code. Can you please also add setter to this functionality?

Thanks,
Oliver

@dr_oli,

Yes, Aspose.Words now provides APIs tp Extract/Read VBA Macros from Word Document. But, unfortunately your question is not clear enough therefore we request you to please elaborate your inquiry further by providing complete details of your usecase. What do you mean by ‘adding setters to this functionality’? This will help us to understand your scenario, and we will be in a better position to address your concerns accordingly.

Hi,

under setter I meant that you provide option also that we can replace existing VBA Macro with new one.
For example, now I can read VBA module and I make programmatically some code changes and want to replace existing module with that what I changed.

Btw. This works, for example, for Aspose.Cells.

Thx,
Oliver

@dr_oli,

Thanks for the additional information. We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-18697. We will further look into the details of this requirement and will keep you updated on the status of the linked issue.

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

@dr_oli,

Regarding WORDSNET-18697, we have added follwoing new public setter to the VbaModule.SourceCode property:

/// <summary>
/// Gets or sets VBA project module source code.
/// </summary>
public string SourceCode

The following code explains how to modify macro source code:

Document doc = new Document(@"test.docm");
VbaProject project = doc.VbaProject;
     
const string newSourceCode = "Test change source code";
     
// Choose a module, and set a new source code.
project.Modules[0].SourceCode = newSourceCode;