Add or remove a shape or button
xlide_manage_shapeAdd or remove Excel worksheet shapes—buttons, checkboxes, text boxes, pictures, and more—while assigning macros and linked cells, then save the workbook.
Instructions
Adds a Forms control, an AutoShape, a text box, a line or a picture to a worksheet, or removes one, and saves the workbook. The usual case is a button that runs a macro: kind='button', a caption in text, and the procedure in macro as Proc or Module.Proc, written first. Place it with cell, its top-left cell, or with left and top in points; width and height are points, with a size to start from when left at 0. Check boxes, option buttons, lists and drop-downs take linked_cell, and lists and drop-downs list_range. A Forms control lives in four parts that have to agree, and they are written and removed together. Removing a shape that runs a macro leaves the macro; removing a chart is not offered. Excel workbooks only; .xlsx, .xlsm and .xlam.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | For add without cell: points from the top. | |
| cell | No | For add: the top-left cell, such as B2. | |
| kind | No | For add: button, checkBox, optionButton, dropDown, listBox, scrollBar, spinner, label, groupBox, shape, textBox, line or picture. | button |
| left | No | For add without cell: points from the left. | |
| text | No | A control's caption, a shape's text, or a picture's alt text. | |
| macro | No | The procedure a click runs: Proc or Module.Proc. | |
| sheet | Yes | Worksheet name, matched without case. | |
| width | No | Points. 0 picks one. | |
| action | Yes | 'add' or 'remove'. | |
| height | No | Points. 0 picks one. | |
| geometry | No | For kind='shape': the preset, such as rect, roundRect or ellipse. | |
| file_path | Yes | Absolute path to the Excel file. | |
| image_path | No | For kind='picture': a PNG, JPEG or GIF file. | |
| list_range | No | The cells a list or drop-down offers: $H$1:$H$9. | |
| shape_name | Yes | The shape's name: new for add, as listed for remove. | |
| linked_cell | No | The cell a control writes its value to: $D$6. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||