Assign a macro to shape in Calc sheet from My Macros

Creating a macro - Writing a Script - Using the API

Assign a macro to shape in Calc sheet from My Macros

Postby sanmahaan » Thu May 11, 2017 9:41 am

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
sanmahaan
 
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

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

Postby Zizi64 » Thu May 11, 2017 10:21 am

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; LibreOffice4.4.7 - Portable versions: LO3.3.0-LO5.3.3 and AOO4.1.3; on Win7x64Prof.
Please, edit the topic's initial post, and add the word "[Solved]" at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 5137
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Postby sanmahaan » Thu May 11, 2017 10:31 am

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
sanmahaan
 
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

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

Postby Villeroy » Thu May 11, 2017 12:50 pm

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 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 23739
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Postby sanmahaan » Thu May 11, 2017 1:48 pm

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
sanmahaan
 
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

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

Postby Villeroy » Thu May 11, 2017 2:17 pm

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 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 23739
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Postby Zizi64 » Thu May 11, 2017 4:24 pm

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; LibreOffice4.4.7 - Portable versions: LO3.3.0-LO5.3.3 and AOO4.1.3; on Win7x64Prof.
Please, edit the topic's initial post, and add the word "[Solved]" at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 5137
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Postby Villeroy » Thu May 11, 2017 4:59 pm

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 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 23739
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Postby sanmahaan » Fri May 12, 2017 7:37 am

Screenshot-1.png
Screenshot-1.png (4.9 KiB) Viewed 137 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

Postby sanmahaan » Fri May 12, 2017 7:42 am

Screenshot-3.png
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
sanmahaan
 
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

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

Postby Zizi64 » Fri May 12, 2017 8:16 am

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
https://forum.openoffice.org/en/forum/v ... 74&t=12426

Try to reinstall the LibreOffice.

Upgrade your LO to te latest Still version.
Tibor Kovacs, Hungary; LibreOffice4.4.7 - Portable versions: LO3.3.0-LO5.3.3 and AOO4.1.3; on Win7x64Prof.
Please, edit the topic's initial post, and add the word "[Solved]" at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 5137
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 6 guests