How to define macro to launch

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Bambamn
Posts: 43
Joined: Fri Nov 02, 2012 8:38 pm

How to define macro to launch

Post by Bambamn »

know this is solved, but I have a question about it. Let me know if I should start a new question or not.

To launch a macro, it was posted to use this code:

Code: Select all

Sub CreateButton
  oDoc = ThisComponent
  oSheet = oDoc.Sheets.getByIndex(0)
  oDrawPage = oSheet.DrawPage  'Was oDrawPage = oDoc.getDrawPage()

  sScriptURL = "vnd.sun.star.script:Standard.Module1.ButtonPushEvent?language=Basic&location=document"
  oButtonModel = AddNewButton("Button_1", "Button_1", oDoc, oDrawPage)
  oForm = oDrawPage.getForms().getByIndex(0)
  ' find index inside the form container
  nIndex = GetIndex(oButtonModel, oForm)
  AssignAction(nIndex, sScriptURL, oForm)

End Sub
My question is:
Where do you define the macro that you wanr lunched?? For example: I have a macro called NEWENTRY and the below image shows where it is in the macro tree. How do I define it in the hyperlink code??
Screenshot_18a.png
I
 Edit: Split from [Solved] Calc basic macro to add a button to a cell
New problem should have new topic.
 
OpenOffice Win 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to define macro to launch

Post by Villeroy »

vnd.sun.star.script:Library.Module.Routine?language=Basic&location=application
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
Post Reply