The code: 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 dim aOptions(5) as New com.sun.star.beans.PropertyValue aOptions(0).Name="LibName": aOptions(0).Value="Standard" 'Name of library aOptions(1).Name="Name": aOptions(1).Value="Module1" 'Name from Module or Dialog aOptions(2).Name="Line": aOptions(2).Value=440 'Linenumber to set the cursor. NOTE: I which I could go to the last cursor or a marker... aOptions(3).Name="Type": aOptions(3).Value="Module" 'Module or Dialog aTemp=split(ConvertFromURL(ThisComponent.GetURL),"\") aTemp=split(aTemp(uBound(aTemp)),".") 'Get filename aOptions(4).Name="Document": aOptions(4).Value=aTemp(0) 'Name of the document = filename without extention oFrame = CreateUnoService("com.sun.star.frame.Frame") oDispatchHelper = createUnoService("com.sun.star.frame.DispatchHelper") oTemp = oDispatchHelper.ExecuteDispatch(oFrame, ".uno:BasicIDEAppear" ,"" ,0 ,aOptions()) end sub seems not to work any more for at least 6 years! A workaround is to write a subroutine in the module to open, like the following: Sub openBasicIDE thisComponent.makeError End Sub See the following discussion: https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=75031
Created attachment 112944 [details] test file Works OK on win7, LO 4.3.5.
Comment on attachment 112944 [details] test file Thanks. I downloaded your spreadsheet and clicked the button. It opened an empty IDE. I do have a screenshot, but do not know how to attach it here ...
Created attachment 112951 [details] Screenshot of empty IDE Window porduced by test file
(In reply to g1234 from comment #2) > Thanks. I downloaded your spreadsheet and clicked the button. It opened an > empty IDE. I do have a screenshot, but do not know how to attach it here ... And what should be opened?
Well, you are right! This is already more than I got that far. What should be opened? If you look at my screenshot a little closer, the window is totally empty, no code modules to select and work on, no dialogs, not even empty modules and dialogs. I did some testing and found out, the IDE is trying to open Module1 from the Standard library from My Macros. My My Macros/Standard library is empty (no module in it, like it is the default after installation). So the IDE tried to load a module which does not exist and instead of the default behavior (when opened via the userinterface) it displays nothing at all. BUT the codesample is not supposed to load the standard library from My Macros, it is supposed to load the Standard library from the document and load the module from there and of course display it.
I tried to rename the library but macro still open MyMacros/standard (in my case this exists). This is the same in version 3.5, linux. Setting version as Inherited from OOo - see link to forum. Leaving unconfirmed, not sure if it's a bug or macro needs to be adapted (from discussion https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=14849 : "it is because the name of the window title of the Basic IDE has changed. ")
I don't see how a window title has to do with it. The dispacher gets the instruction to let the Basic IDE appear, it gets the document name, the library name, the module name and the linenumber. This is exactly the information it needs to display the code to be edited. I understand, that there might be the window title envolved somehow internally but that would be something the UNO service would have to handle (or any other componenet). On the other hand, I myself have no problem if this code doesn't work anymore (for reasons I do not know). The question than would be, what is the right call to get this done today and in the future. Maby the hole thing is just a question of documentation. But, if the code worked somewhen and now it does not work anymore, and that is not on purpose (which would have to be dokumented as being on purpose) then I would call it a bug.
Is the code of the UNO service BasicIDEAppear available? I guess it is. The right question would be: "How can I find it." If I had it, I could try to find out what this service does. Maybe the interface just changed and nobody knows how the call is supposed to be done. Actually, since the Office menucommand Tools/Macros/manage Macros/LibreOffice Basic... opens the Basic IDE and loads the right module into it, there must be a working solution to the problem. I already tried the macro recorder of the Windows version of LibreOffice, but it just records how to open the manage Macros dialog and not how the Dialog itself opens the IDE than.
Well, I spend a few hours over the weekend do look at the LibreOffice code. Expected to find a class BasicIDE with a method Appear where I can find the structure of the properties it accepts. But I did not find any. It seems to me, that there is alot of old code mixed with new code. The basicide stuff seems to be more of the old code. I found a couple of invocations of the code in my codesample sOpenMacroEditor. But this of course only means that this code worked somewhen. I can't tell if that code is still active or not used any more.
Created attachment 113074 [details] Working macro It is rather simple to get the BasicIDE to open with a library.module in an LO file. The key is to pass the document URL as the Document option, like so: aOptions(0).Name="Document" aOptions(0).Value=ThisComponent.GetURL ' full URL of current file aOptions(1).Name="LibName" aOptions(1).Value="Standard" ' Name of library aOptions(2).Name="Type" aOptions(2).Value="Module" ' Module or Dialog aOptions(3).Name="Name" aOptions(3).Value="Module1" ' Name of Module or Dialog aOptions(4).Name="Line" aOptions(4).Value=13 ' Linenumber to place the cursor. [rest of code in attachment] Although this is not a bug in the underlying code, there seems to be a complete documentation fail for uno.BasicIDEAppear This has been considered a bug since OOo 3.0, but I'm guessing it was probably an undocumented correction/enhancement to go to a URL format for the Document to enable network file access. BasicIDEAppear is forgiving: can leave off Type, Name, etc. and just end up at the top of the first module. If Document is blank or not found, it defaults to My Macros & Dialogs (as noted). There may be some way to get it to open in the built-in Libre Office Macros & Dialogs set (URL to file containing them?). I didn't try for that figuring they are available once the IDE is open and should be treated as read-only.
Is documentation fail and not a bug
Here is the source of the solution: https://forum.openoffice.org/en/forum/viewtopic.php?t=75031&p=340518
Thanks alot for your help! I was searching a long time for a way to get this done and the only I got was the hint in the discussion I started on forum.openoffice.org, which I already updated with the correct solution. You write about a documentation fail. So where do I find this documentation?
(In reply to g1234 from comment #13) > ... > I was searching a long time for a way to get this done and the only I got > was the hint in the discussion I started on forum.openoffice.org, which I > already updated with the correct solution. > > You write about a documentation fail. So where do I find this documentation? Exactly. There may be some user or dev documentation for .uno:BasicIDEAppear but I was unable to find any. Hence, I wrote (emphasis added): >there *seems* to be a *complete* documentation fail for uno.BasicIDEAppear I can imagine that it might be useful to open the Basic IDE while running soffice in the background to tweak a script that does some processing on docs. It is possible to open the IDE from a terminal with: :-o> soffice ".uno:BasicIDEAppear" So, there *may* be some way to target that IDE open by passing in document URL and library. However, it appears that this "has been left as an exercise for the reader" ;-)
Sorry, that is no answer! There must be some documentation somewhere. Where die YOU find the documentation? How did you find the changed solution?