How do I set a button to execute a macro in calc?

I’d like a button in a cell to execute a macro but haven’t been able to figure it out.

Can someone point me to a set of instructions, preferably like step 1, step 2 step 3.

Jumping back and forth between the OO basic, calc and API docs has me quite confused at the moment.

Thanks,
Mike

I selected cell C1, which is where I
want the button.

You can not put a graphical objects (like the form control elements) into a cell. The graphical objects are located on a graphical layer what is independent from the cells. But you can align the button to a cell visually, and you can anchor a button to a cell.

I did toggle edit mode and suspect
I’ve got a button in the cell now, not
sure. How do I access properties?

  • It is not enough to click on the Form control icon and on the Cell C1. You must “draw” a rectangle for the button on the graphical layer by dragging the mouse.
  • How to edit the Properties and Events of a button: Right click on the button - Control. Finally switch OFF the edit mode.

hello @MikeMcClain46,

  1. view - toolbars - form controls,
  2. add ‘push button’,
  3. edit it’s properties and assign your macro somewhere at ‘release button’,
  4. you have to switch of form controls ‘edit mode’ to be able to use the button,
  5. some actions are difficult for buttons search for questions about ‘taking focus’ and follow advice there,

regards

b.

Hello newbie-02,

Pardon me for being so dense.

I selected cell C1, which is where I want the button.

view - toolbars - form controls, clicked ‘push button’, but see no change.

I tried dragging the button off the toolbar, doesn’t work.

What am I missing?

Thanks,
Mike

works for me, easiest fail: are the icons in the form control toolbar grey? then you first need to activate ‘edit mode’ there …

No they weren’t grayed out.
I did toggle edit mode and suspect I’ve got a button in the cell now, not sure.
How do I access properties?

what about right click on the button (while in edit mode) - control properties - tab ‘events’ - mouse button released?
i’d never say such things are easy or ‘intuitive’ in calc, but it’s a powerful system and after some learning and tolerating some oddities one can do a lot with it …
b.t.w. ‘solved marks and likes welcome’ … once it works …

newbie-02, I appreciate the help but I just needed more detail than you were supplying due to my own ignorance.

With what you gave me plus what these had to say, I finally got it done.
https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=104235
https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=55567 
http://www.openoffice.org/documentation/HOW_TO/various_topics/How_to_use_basic_macros.sxw

To make a button: 
        View>Toolbars>Form Controls
        Turn on design mode (button #2)
	Select PushButton on ToolBar, hover cursor over icons for description.
	In spread sheet, click/drag left mouse button to draw a button.
	Right click (middle for me) on button, select 'Control.
	This will bring up properties Dialog.
	Under 'General'
		Set 'Label', 
		Printable = No (do not print the button)
		Repeat = No
		Take Focus on Click = No
		Set color if you like
		Action = None
	Under 'Events', at the top of the dialog,
		'Mouse button released' click the box 
			then click the little box on the right [...]
			select 'Macro', then select the macro to run.
			Click 'OK'
		close the properties dialog
	Back to the 'Form Controls' Toolbar, click 'DesignMode', button 2 to leave design mode.
	close the Toolbar
		
	Turn off design mode, close the tool bar.

I'll leave this for the next tyro who asks this question.

Be well,
Mike
2 Likes

:slight_smile:
everyone works better in tasks where he had to invest some own effort,
happy that you got it running …