Assign a macro to shape in Calc sheet from My Macros

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
sanmahaan
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

Assign a macro to shape in Calc sheet from My Macros

Post by sanmahaan »

Hello,

I wish to assign a macro from My Macros
to a shape, say a rectangle box.
in a Calc Sheet.

But on trying to do so,
I am not able to access the macros in MY MACROS.

I realise that maybe only the macros of the open CALC sheet are only accessible.

Is there a way to assign the macros in MY MACROS to the shape in a CALC sheet.

(I am new to LibreOffice.)

Thanks in advance.
Libreoffice 4.0.2.2 on LINUX
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Assign a macro to shape in Calc sheet from My Macros

Post by Zizi64 »

I realise that maybe only the macros of the open CALC sheet are only accessible.

Is there a way to assign the macros in MY MACROS to the shape in a CALC sheet.
Do you want to assign a macro from a custom Module of the MyMacros/Standard library?
It is works for me. I can assign a macro from these Modules. (These are my own macros.)
Note: if those macros are available in your PC only, the macros assigned to the shape will not work in an another PC, when you send the document to others. It is better to embed the macro code into the document - if you want to send the document to others.
Last edited by Zizi64 on Thu May 11, 2017 3:52 pm, edited 1 time in total.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
sanmahaan
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

Re: Assign a macro to shape in Calc sheet from My Macros

Post by sanmahaan »

Thank you Zizi64 for your response.
I am not able to view the macros while trying to assign them to the rectangle shape.

In the pop up, there are two boxes with headings "Macros" and "Existing Macros" and both are empty.
THe Assign button is disabled.

But when I try to assign a macro to a button I am able to navigate to the Macros dialogue.

Not sure why I am unable to view the macros list while trying to assign to a shape in Calc page.

Also to put aside doubts.. all of these are in one system only.. no two PCs are involved.

Help requested
Libreoffice 4.0.2.2 on LINUX
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Assign a macro to shape in Calc sheet from My Macros

Post by Villeroy »

We have a tutorial section with subsections for components.

[Tutorial] How to install a code snippet
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
sanmahaan
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

Re: Assign a macro to shape in Calc sheet from My Macros

Post by sanmahaan »

Thank you Villeroy..
I have checked your info.. (except the site, which I shall check later)..
am unable to work out my solution yet.
Help requested.
Libreoffice 4.0.2.2 on LINUX
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Assign a macro to shape in Calc sheet from My Macros

Post by Villeroy »

You fetch some item from the "Drawing" toolbar and draw it onto some document, right? Which type of item? Which type of document?
What do you do next? I can not find any option to assign a macro to a rectangle shape on a Writer document. So I assume that its not possible.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Assign a macro to shape in Calc sheet from My Macros

Post by Zizi64 »

I am not able to view the macros while trying to assign them to the rectangle shape.

In the pop up, there are two boxes with headings "Macros" and "Existing Macros" and both are empty.
THe Assign button is disabled.
Right click on the shape - Assign Macro:
Assign_Macro1.png
MyMacros - Standard - here will apeared your Modules:
Assign_Macro2.png
select the desired Module, and the select the desired Macro subroutine (one of the existing user defined macros). - The 'Assign' button will highlighted. Click on it. The selected macro will be assigned to the 'click event' of the shape:
Assign_Macro3.png
Click on the OK. The macro will work, when you click (left click) on the shape.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Assign a macro to shape in Calc sheet from My Macros

Post by Villeroy »

Only in Calc and Impress the context menu of a shape allows you to assign a macro. There is no such menu item availlable in Draw and Writer.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
sanmahaan
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

Re: Assign a macro to shape in Calc sheet from My Macros

Post by sanmahaan »

Screenshot-1.png
Screenshot-1.png (4.9 KiB) Viewed 4092 times
Selecting the rectangle shape from the Toolbar in the calc sheet
Screenshot-2.png
trying to assign macro to the shape in the CALC sheet
Screenshot.png
Unable to view any macros, though I can view all this for other shapes

I am in CALC sheet (not Writer).. Hope this makes my position clear.

Help requested.
Thanks in advance
Libreoffice 4.0.2.2 on LINUX
sanmahaan
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

Re: Assign a macro to shape in Calc sheet from My Macros

Post by sanmahaan »

By shapes I meant the button.. I am able to view the list of macros for button but not for rectangle shape
By shapes I meant the button.. I am able to view the list of macros for button but not for rectangle shape
Libreoffice 4.0.2.2 on LINUX
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Assign a macro to shape in Calc sheet from My Macros

Post by Zizi64 »

Libreoffice 4.0.2.2 on LINUX
Maybe it is a bug in your version... I am using LO 4.4.7, but it works in my Portable LO 5.2.6 and Portable LO.5.3.2 and in my Portable AOO 4.1.3.


Tips:
Check if a JRE is installed and works...

Try to reset (delete or rename) the user profile of your LibreOffice
viewtopic.php?f=74&t=12426

Try to reinstall the LibreOffice.

Upgrade your LO to te latest Still version.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply