Create a button to run an Office Script
Applies To
Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the webAn Office Script is a convenient way to automate common tasks. Help your colleagues find and run your Office Scripts by adding a script button to a workbook. This makes it easy for anyone in the workbook to run the script.
Create a script button
This procedure creates a button in the workbook that runs the script when the button is selected. It also shares the script with anyone who can edit the workbook.
-
Select Automate, and then select the script you want to run.
-
If the script is not visible in the gallery, select All Scripts.
-
In the Code Editor pane, under Script access, select Add in workbook.
Remove a script button
This procedure removes all the buttons that run the script.
-
Select Automate, and then select the script you want to run.
-
If the script is not visible in the gallery, select All Scripts.
-
In the Code Editor pane, under Script access, select the arrow next to Add in workbook and choose the option Remove from workbook.
Note: If you delete script button, the script is removed, but only from that specific button. You can’t undo this delete operation and you can’t cut and paste the button elsewhere in the workbook.
See Also
Introduction to Office Scripts in Excel