Ask Your Question

Error at getbyname in the LoadDialog function [closed]

asked 2017-06-16 22:40:41 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

When trying to run the very simple script:

Dim Dialog1 as object
Sub Dialog1Show   
      oDialog1 = LoadDialog("Standard", "Dialog1", DialogLibraries)
      oTextField = oDialog1.getControl("dte") 'Textbox to display date'
      oTextField.settext Format (Date,"mm/dd")

End Sub

I got an error at the LoadDialog function.

Function LoadDialog(Libname as String, DialogName as String, Optional oLibContainer)
Dim oLib as Object
Dim oLibDialog as Object
Dim oRuntimeDialog as Object
    If IsMissing(oLibContainer ) then
        oLibContainer = DialogLibraries
    End If
    oLib = oLibContainer.GetByName(Libname)
    oLibDialog = oLib.GetByName(DialogName)
    oRuntimeDialog = CreateUnoDialog(oLibDialog)
    LoadDialog() = oRuntimeDialog
End Function

When the function gets to the line oLibDialog = oLib.GetByName(DialogName) I get an error:

BASIC runtime error. An exception occurred Type: Message: .

But I cannot figure out why. The same script seems to be working for many people so I am at lost here... My libreoffice is running under Ubuntu 16.04

Any help will be appreciated.


edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-10-07 01:39:15.968627


I fixed your formatting.

EasyTrieve gravatar imageEasyTrieve ( 2017-06-17 04:53:01 +0100 )edit

Same error here trying to start the AltSearch extension.

Environment: OS X 10.9.5, Libreoffice, JaveRE Oracle 1.8.0_20, AltSearch 1.4.2

I would even be able to pay a bill for fixing this, working for a non-profit organisation that is interested in the quality of free and open source software.

mois gravatar imagemois ( 2019-06-12 12:02:15 +0100 )edit

2 Answers

Sort by » oldest newest most voted

answered 2017-06-17 19:45:25 +0100

EasyTrieve gravatar image

When the function gets to the line

 oLibDialog = oLib.GetByName(DialogName)

I get an error:

BASIC runtime error. 
An exception occurred Type:  
Message: .

This says that oLib does not contain the object specified by the string in DialogName.

Since you are setting oLib with this:

oLib = oLibContainer.GetByName(Libname)

Then I would use MRI to investigate where things are going wrong. Try putting mri oLibContainer before these lines and then use MRI to drill down into the mess. In other words in mri select the methods and then select LoadLibrary and enter your library name. Then select the method getByName and see if what you want is there.

I've found getByName in MRI to be very handy to confirm where I think I am in the object mesh.

edit flag offensive delete link more

answered 2017-06-16 23:54:55 +0100

Ratslinger gravatar image

@fabriosan please learn to use the toolbar in a question/answer to format your code properly. It is difficult at best to comprehend. Also, not sure why you posted as Wiki - this limits your capabilities and does not allow recognition to those taking the time to answer your questions.

The library to load is where your dialog resides.

Sub openAboutDialog
    Dim Dlg As Object
    Dlg = CreateUnoDialog(DialogLibraries.Standard.NAME_OF_YOUR_DIALOG)
End Sub

Much more detailed information on libraries & macros can be found in OOME - pdf here.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-06-16 22:40:41 +0100

Seen: 652 times

Last updated: Jun 17 '17