Add, Extract, and Remove VBA Macros in PowerPoint using Java

add remove powerpoint vba Java

VBA macros are used to perform repetitive tasks, generate charts and forms, etc. in PowerPoint presentations. While working with the presentations programmatically, you may need to manipulate VBA macros. In accordance with that, in this article, you will learn how to add, extract or remove VBA macros in PowerPoint presentations using Java.

TIP

You may want to try Aspose online VBA macro removal tool.

Java API for PowerPoint VBA Macros

In order to work with VBA macros in presentations, we will use Aspose.Slides for Java. It is a feature-rich API that lets you create or manipulate PowerPoint presentations from within your Java applications. You can either download the API or install it using the following Maven configurations.

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>http://repository.aspose.com/repo/</url>
</repository>
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-slides</artifactId>
    <version>21.7</version>
    <classifier>jdk16</classifier>
</dependency>

Add VBA Macro in PowerPoint Presentations using Java

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

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

Extract VBA Macros from PowerPoint using Java

The following are the steps to extract VBA macros from a PowerPoint presentation using Java.

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

Remove PowerPoint VBA Macros

You can also remove a particular VBA macro from a PowerPoint using its index in 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 use Aspose.Slides for Java without evaluation limitations by requesting a temporary license.

TIP

You may want to try Aspose online VBA macro removal tool.

Conclusion

In this article, you have learned how to work with PowerPoint VBA macros using Java. 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