Assign Macro Code to Form Control
Contents
[
Hide
]
Aspose.Cells allows you to assign a Macro Code to a Form Control like a Button. Please use the ShapeCollection.addShape() method to assign a new Macro Code to a Form Control inside the workbook.
Assigning Macro Code to Form Control using Aspose.Cells
The following sample code creates a new workbook, assign a Macro Code to a Form Buttom and saves the output in the XLSM format. Once, you will open the output XLSM file in Microsoft Excel you will see the following macro code.
Sub ShowMessage()
MsgBox "Welcome to Aspose!"
End Sub
Here is a sample code to generate the output XLSM file with Macro Code.