Create a VBA Module

Introduction

VBA modules in PowerPoint are used to automate tasks and add functionality that is not supported by the standard PowerPoint features. VBA allows you to write macros and create custom functions that can perform various operations, such as modifying slides, working with objects on a slide, managing animations, and much more. Use the folowing method to add modules to VBA projects.

CreateVbaModule

API Information

API Type Description Resource
/slides/{name}/vbaProject/modules POST Adds a module to a VBA project in a presentation saved in a storage. CreateVbaModule

Request Parameters

Name Type Location Required Description
name string path true The name of a presentation file.
moduleDto VbaModule body true The data transfer object with module parameters.
password string header false The password to open the presentation.
folder string query false The path to the folder containing the presentation file.
storage string query false The name of the storage contaning the folder.

Examples

The default storage contains the document MyPresentation.pptm. Add a module MyModule for a macro MyMacro with the following code:

Sub MyMacro()
    MsgBox "Hello, World!"
End Sub

cURL Solution

SDK Solutions

The result:

The VBA module

SDKs

Check Available SDKs to learn how to add an SDK to your project.