[Calc] Get Macro-Editor open fast with 1 button

Shared Libraries
Forum rules
For sharing working examples of macros / scripts. These can be in any script language supported by OpenOffice.org [Basic, Python, Netbean] or as source code files in Java or C# even - but requires the actual source code listing. This section is not for asking questions about writing your own macros.
Post Reply
User avatar
onidarbe
Posts: 84
Joined: Thu Nov 29, 2007 8:03 pm
Location: Belgium, Mechelen

[Calc] Get Macro-Editor open fast with 1 button

Post by onidarbe »

To speed up opening the macro-editor with clicking on 1 button.
Because I get to many error-loops where I need to terminate OO with ctrl-alt-del and to get back to programming fast. ;)

Code: Select all

sub sOpenMacroEditor      'Assigned to a button to speed up opening the macro editor in this code.
   dim aOptions(5) as New com.sun.star.beans.PropertyValue
'Name of library
   aOptions(0).Name="LibName" : aOptions(0).Value="Standard"   
'Name from Module or Dialog
   aOptions(1).Name="Name" : aOptions(1).Value="Module1"       
'Linenumber to set the cursor.   
   aOptions(2).Name="Line" : aOptions(2).Value=300                    
'NOTE: I which I could go to the last cursor or a marker like a special word :?: 
'Module or Dialog
   aOptions(3).Name="Type" : aOptions(3).Value="Module"            
'Split full path\filename into an array
   aTemp=split(ConvertFromURL(ThisComponent.GetURL),"\")     
'Get filename from the last array used and remove the extention
   aTemp=split(aTemp(uBound(aTemp)),".")
'Name of the document = filename without extention
   aOptions(4).Name="Document" : aOptions(4).Value=aTemp(0)   
   oFrame = CreateUnoService("com.sun.star.frame.Frame")
   oDispatchHelper = createUnoService("com.sun.star.frame.DispatchHelper")
   oTemp = oDispatchHelper.ExecuteDispatch(oFrame, ".uno:BasicIDEAppear" ,"" ,0 ,aOptions())
end sub
Last edited by Villeroy on Thu Sep 18, 2008 10:38 pm, edited 2 times in total.
OOo 3.1.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Get Macro-Editor open fast with 1 button. Calc-OOoBasic

Post by Villeroy »

Thank you for this one. Very nice, beeing able to jump right into the current project. A few days ago I discovered Alt+F11 by mistake.
I put the code-tags around the code and shortened the lines by moving end-of-line comments into their own lines. This way the code lands alright in the code editor. A long line of text, copied from the browser, sometimes paste as two lines.
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
onidarbe
Posts: 84
Joined: Thu Nov 29, 2007 8:03 pm
Location: Belgium, Mechelen

Re: Get Macro-Editor open fast with 1 button. Calc-OOoBasic

Post by onidarbe »

Villeroy wrote:I put the code-tags around the code and shortened the lines by moving end-of-line comments into their own lines.
:o I didn't know anyone can just change the typing of an other!!!
OOo 3.1.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Get Macro-Editor open fast with 1 button. Calc-OOoBasic

Post by Villeroy »

onidarbe wrote:
Villeroy wrote:I put the code-tags around the code and shortened the lines by moving end-of-line comments into their own lines.
:o I didn't know anyone can just change the typing of an other!!!
I'm a member of the moderator group.
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
onidarbe
Posts: 84
Joined: Thu Nov 29, 2007 8:03 pm
Location: Belgium, Mechelen

Re: Get Macro-Editor open fast with 1 button. Calc-OOoBasic

Post by onidarbe »

NOTE: This code snippet did work nice op OO version 2, but doesn't work on version 3.0.1
OOo 3.1.X on Ms Windows XP
User avatar
onidarbe
Posts: 84
Joined: Thu Nov 29, 2007 8:03 pm
Location: Belgium, Mechelen

Re: Get Macro-Editor open fast with 1 button. Calc-OOoBasic

Post by onidarbe »

As long as there isn't a real solution one could just make a program error to get to that line.
So just make a small sub with an error in it, assign a button in the toolbars to it and click on it ;-)

Code: Select all

sub sOpenMacroEditor 'Assigned to a button to speed up opening the macro editor in this code.
   'to assign it to a button: ooCalc/Tools/Customize/ToolBars/Add.../OpenOffice.org Macros/ThisFilename/Standard/Module1/sOpenMacroEditor/Add
   thisComponent.makeErrorToGetHere
end sub
Post Reply