Page 1 of 1

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

Posted: Thu Sep 18, 2008 9:07 pm
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

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

Posted: Thu Sep 18, 2008 10:44 pm
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.

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

Posted: Thu Sep 25, 2008 3:32 pm
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!!!

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

Posted: Thu Sep 25, 2008 3:34 pm
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.

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

Posted: Thu Jan 29, 2009 11:38 pm
by onidarbe
NOTE: This code snippet did work nice op OO version 2, but doesn't work on version 3.0.1

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

Posted: Sun Feb 08, 2009 3:31 pm
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