Opening a Dialogue With Program Code

In the LibreOffice BASIC window for a dialogue that you created, leave the dialogue editor by clicking the name tab of the Module that the dialogue is assigned to. The name tab is at the bottom of the window.

Enter the following code for a subroutine called Dialog1Show. In this example, the name of the dialogue that you created is "Dialog1":

Sub Dialog1Show

    BasicLibraries.LoadLibrary("Tools")

    oDialog1 = LoadDialog("Standard", "Dialog1")

    oDialog1.Execute()

End Sub

Without using "LoadDialog" you can call the code as follows:

Sub Dialog1Show

    DialogLibraries.LoadLibrary("Standard")

    oDialog1 = CreateUnoDialog( DialogLibraries.Standard.Dialog1 )

    oDialog1.Execute()

End Sub

When you execute this code, "Dialog1" opens. To close the dialogue, click the close button (x) on its title bar.