add remove powerpoint vba C#

The VBA macros are used to automate different functionalities in PowerPoint presentations. For example, you can use VBA to perform repetitive tasks, generate charts and forms, etc. In this article, you will learn how to work with PowerPoint VBA macros programmatically. Particularly, the article will cover how to add, extract or remove VBA macros in PowerPoint presentations using C#.

C# API for PowerPoint VBA Macros

Aspose.Slides for .NET is a feature-rich API that lets you create, edit and convert PowerPoint presentations using C#. Furthermore, the API allows you to work with VBA macros seamlessly. In order to use the API, you can either download its DLL or install it using NuGet.

PM> Install-Package Aspose.Slides.NET

Add VBA Macro in PowerPoint Presentations using C#

The following are the steps to add a VBA macro in a PowerPoint presentation using C#.

The following code sample shows how to add VBA macro in a PowerPoint presentation using C#.

Extract VBA Macros from PowerPoint using C#

Aspose.Slides for .NET also allows you to extract VBA modules from VBA projects in PowerPoint presentations. The following are the steps to perform this operation.

The following code sample shows how to extract PowerPoint VBA macros using C#.

Remove PowerPoint VBA Macros

You can also remove a particular VBA macro from a PowerPoint presentation. For this, you will access and remove the VBA module by its index from the VBA project. The following are the steps to perform this operation.

The following code sample shows how to remove a PowerPoint VBA macro.

Get a Free API License

You can try Aspose.Slides for .NET without evaluation limitations by requesting a temporary license.

Conclusion

In this article, you have learned how to work with PowerPoint VBA macros using C#. Particularly, you have seen how to add, extract and remove VBA macros in PowerPoint presentations. In order to explore other features of the API, you can consult the documentation. Moreover, you can feel free to let us know about your queries via our forum.

See Also

Tip: You may want to check out Aspose FREE macro removal web app.