We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Script is garbled when VBA is set

Hi.

I’m using version “21.2.0” of Aspose.Slides for .NET.

I have added a VBA macro to a PPT file with the following source.
However, if you look at the macro in the resulting file,
The Japanese part was garbled and all were replaced with “?”.

var ppt = new Presentation(originPpt);

ppt.VbaProject = new VbaProject();
var module = ppt.VbaProject.Modules.AddEmptyModule("Ribbon_onLoad");

var script = string.Format(
@"Public Sub Ribbon_onLoad(ribbon As IRibbonUI)
Const EXP_DATE As Date = ""{0}""
Dim NOW_DATE As Date: NOW_DATE = Format(Date, ""yyyy/mm/dd"")
If NOW_DATE <= EXP_DATE Then
MsgBox ""有効期間内です。""
Else
MsgBox ""有効期限を過ぎています。有効期限:"" + Format(EXP_DATE, ""yyyy/mm/dd"")
End If
End Sub
", exp);

module.SourceCode = script.ToString();

ppt.Save(savePath, Aspose.Slides.Export.SaveFormat.Pptm);

I don’t think there is a place to set the character code in the VBA script,
How can I set it to prevent garbled characters?

Attach a screenshot of the created macro.

scsh_2021-03-09 081616.jpg (44.2 KB)

Best Regard.

@yuya,
Thank you for the issue description. To my regret, I cannot reproduce the problem. Could you please share your initial and final PPT files for investigation?