Point a shape at a macro
xlide_set_shape_macroChange the macro assigned to an existing shape or button and save the workbook. Empty macro clears the link; the target macro must already exist in the project.
Instructions
Changes which macro an existing shape or button runs when clicked, and saves the workbook. An empty macro clears the link. Use it after writing a Sub, so a button actually calls it, and after renaming one, because nothing rewrites an OnAction. Give the procedure as Proc or Module.Proc; it must already exist in the project, so write it first. This changes an existing shape only: adding or deleting one is not offered, because a form control lives in four parts that have to agree and a wrong one produces a workbook Excel repairs on open.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| macro | Yes | The procedure to run, as Proc or Module.Proc. Empty clears the link. | |
| sheet | Yes | Worksheet the shape is on. | |
| file_path | Yes | Absolute path to the Excel file. | |
| shape_name | Yes | Shape name, as xlide_list_shapes reports it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||