avoid error message in Base with a Writer macro

With your help I had successfully created a macro that in LibreWriter went to the last point where the cursor was at the end.

After upgrading from Kubuntu 17.04 to Kubuntu 17.10, with the new version of LibreOffice I get an error message, not in Writer, not in Calc, but in Base:

"BASIC runtime error. Property or method not found: supportsService"

and is highlighted the line
“If NOT thisComponent.supportsService (” com.sun.star.text.TextDocument “) Then”
Apparently supportsService is no more recognized in LibreBase (or, better, in Basic: I don’t know!).

I refer to the whole macro:

sub vai_qui
    If NOT ThisComponent.supportsService ("com.sun.star.text.TextDocument") Then
        Exit Sub
    End If

    oBookmarks = ThisComponent.getBookmarks ()
    If NOT oBookmarks.hasByName ("here") Then
        Exit Sub
    End If

    ViewCursor = ThisComponent.CurrentController.getviewCursor ()
    Bookmark = ThisComponent.Bookmarks.getByName ("here") .Anchor
    ViewCursor.gotorange (Bookmark, False)

    ViewCursor = ThisComponent.CurrentController.getviewCursor ()
    Bookmark = ThisComponent.Bookmarks.getByName ("here") .Anchor
    ViewCursor.gotorange (Bookmark, False)
end sub

Could someone help me to avoid the base error message?
Thank you


Using the first part of the macro only:

sub vai_qui
If NOT ThisComponent.supportsService ("com.sun.star.text.TextDocument") Then
    Exit Sub
End If
End sub

I have no problems with running this in either Base or Writer. As you stated, this is a BASIC (program language) problem and not a Base problem. There is possibly a problem with the LO provided by your distro (Kubuntu) - contact them.

My test was done on Mint 18.2 OS with LO v5.4.1.2 from LibreOffice.

Thank you, I will see if it’s as you say with a non kubuntu release of LO

In effect, with a non kubuntu release there is no problem with that error. But, i get another error message, with the mysql direct connect: "SQL Status: HY000 The connection to the external data source could not be established. No SDBC driver was found for the URL ‘sdbc:mysql:mysqlc:localhost:3306/miei’… I will try to resolve it. Thank you!

If this answers your question please click on the :heavy_check_mark: (upper left area of answer).

Also, if you have further problems with the connection, post as new question. Will be happy to get you a proper answer.

When I linked in /opt/lo/share/ uno_packages I got the same error message (basic runtime…) also in non kubuntu release. So I removed that link, which did not solve anything. But the problem was not that link: now I get the same error message, basic runtime. And more I can not connect to mysql.

Sorry, Raslinger, I tried to vote your answer, but I don’t have permission (5 points required). The problem is not solved, because now also in the /opt installation from .deb, i get the error message. :frowning:

@fbertoldi Up voting (or down voting) is not a concern of mine. WHEN your question is answered it is helpful to others if you click on the :heavy_check_mark: to signify the question was answered acceptably.

Let’s start with MySQL. The version from LibreOffice does not come with the MySQL SDBC connector. The one I’ve been using for quite some time is here. Just install under Extensions.

Now you also mention “…linked in /opt/lo/share/ uno_packages I got the same error message”. I don’t understand what you are linking to there. Can you please explain as that is not an area to be linking anything.

Thank you, Ratslinger : 1) I know that direct connector is an extension (for the non ubuntu releases: ubuntu has a via synaptic addon for mysql-direct-connect, very useful), but I am the same user with two different releases of LO, I don’t want leave totally ubuntu release, and settings of both releases are stored in home./config/libreoffice, isn’t?
2) Was an attempted to import the non-kubuntu release into the direct-connect extension but did not work.

Just tried switching to different OS with distro version installed. Can’t give answer one way or the other. I don’t see a problem with the little testing I just did but if in doubt either don’t do it or make a copy of the config folder before trying. Have tried other SDBC connectors ( including synaptic) but the link presented has provided the best results (some didn’t work at all).

Somewhat lost in all this. Has your original question been answered?

I have to try removing kubuntu release and try only with a non-kubuntu release of LO, I will do it on Thursday. Then I will write, if all will be fine, resolved. Thank you.

I tried to completely remove the kubuntu version of LO: a disaster. The non-kubuntu version continues to make that error; and more, crashes on crashes. (Maybe I could not completely remove the kubuntu version …)

Here is what I use to remove my previous installs:

 sudo apt-get remove --purge libreoffice5*
 sudo apt-get clean
 sudo apt-get autoremove

Then you should rename your LO user profile so a new one is created - see this post.

Finally install LibreOffice. This should give you a clean install.

yesterday a disaster: no more grafical destop; so new installation; the command, done defore I read your help, “sudo apt remove libreoffice 5.4” removed also many sddm files :frowning:

The problem is the release of LibreOffice: 5.3 working with the macro, 5.4 not working (bug)

I believe you are speaking of the distro version?