[Solved] Dialog in sheet library

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Fraz627
Posts: 22
Joined: Sat Jun 17, 2017 8:31 am

[Solved] Dialog in sheet library

Post by Fraz627 »

Need Help with a dialog box macro. I created dialog box and launched from a macro, the location of both was orignally in the MyMacro library. After creation I moved them to the actual sheet library and now the Macro does not work.

I searched the net and found were a subscrper to this forum had the exact problem by no mention was made to the solution.

Attached is my code (which I got from the internet)

Code: Select all

Sub StartDialog1()
    ' Code for initiating and showing the dialog
    BasicLibraries.LoadLibrary("Tools")
    oDialog1 = LoadDialog("Standard", "Dialog1")
    oDialog1.Execute()
End Sub
Any suggestions
Last edited by Fraz627 on Fri Jun 30, 2017 10:08 am, edited 1 time in total.
Open Office 4.1 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Dialog in sheet library

Post by Villeroy »

"My Macros" is the place where global libraries are stored for the current user. It always has one "Standard" library and you can edit these libraries freely.
"OpenOffice Macros" is the place where global libraries are stored for all users of this installation. It comes with some example libraries such as the "Tools" library. You can not edit these libraries easily.
Both places combined are the "GlobalScope" of all libraries that are not embedded in documents. You can not add a "Standard" library to "OpenOffice Macros" because "Standard" exists in "My Macros" already. You can not add a "Tools" library to "My Macros" because "Tools" exists in "OpenOffice Macros" already.

Code: Select all

BasicLibraries.LoadLibrary("Tools")
refers to a "Tools" library in the same document as the calling macro.

If you want to load a GlobalScope library from either "My Macros" or "OpenOffice Macros":

Code: Select all

GlobalScope.BasicLibraries.LoadLibrary("Tools")
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
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Dialog in sheet library

Post by Villeroy »

"My Macros" is the place where global libraries are stored for the current user. It always has one "Standard" library and you can edit these libraries freely.
"OpenOffice Macros" is the place where global libraries are stored for all users of this installation. It comes with some example libraries such as the "Tools" library. You can not edit these libraries easily.
Both places combined are the "GlobalScope" of all libraries that are not embedded in documents. You can not add a "Standard" library to "OpenOffice Macros" because "Standard" exists in "My Macros" already. You can not add a "Tools" library to "My Macros" because "Tools" exists in "OpenOffice Macros" already.

Code: Select all

BasicLibraries.LoadLibrary("Tools")
refers to a "Tools" library in the same document as the calling macro.

If you want to load a GlobalScope library from either "My Macros" or "OpenOffice Macros":

Code: Select all

GlobalScope.BasicLibraries.LoadLibrary("Tools")
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
UnklDonald418
Volunteer
Posts: 1549
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Dialog in sheet library

Post by UnklDonald418 »

I moved them to the actual sheet library
Assuming you moved them both into the Standard directory of the sheet library try:

Code: Select all

Sub StartDialog1()
' Code for initiating and showing the dialog

DialogLibraries.LoadLibrary("Standard")
oDialog1 = CreateUnoDialog( DialogLibraries.Standard.Dialog1)
oDialog1.Execute()

End Sub
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Post Reply