[Solved] Dialog in sheet library

Creating a macro - Writing a Script - Using the API

[Solved] Dialog in sheet library

Postby Fraz627 » Thu Jun 29, 2017 11:39 am

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   Expand viewCollapse view
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
Fraz627
 
Posts: 15
Joined: Sat Jun 17, 2017 8:31 am

Re: Dialog in sheet library

Postby Villeroy » Thu Jun 29, 2017 1:34 pm

"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   Expand viewCollapse view
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   Expand viewCollapse view
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 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 24404
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Dialog in sheet library

Postby Villeroy » Thu Jun 29, 2017 1:39 pm

"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   Expand viewCollapse view
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   Expand viewCollapse view
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 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 24404
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Dialog in sheet library

Postby UnklDonald418 » Thu Jun 29, 2017 5:52 pm

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   Expand viewCollapse view
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 subject line
Apache OpenOffice 4.1.3 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 548
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 6 guests