# 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

edit retag close merge delete

Sort by » oldest newest most voted

Hello,

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.

more

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

( 2017-10-29 15:44:56 +0200 )edit

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!

( 2017-10-29 16:20:39 +0200 )edit

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

( 2017-10-29 16:22:48 +0200 )edit

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.

( 2017-10-29 16:32:14 +0200 )edit

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. :(

( 2017-10-29 17:36:44 +0200 )edit

@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 ✔ 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.

( 2017-10-29 18:27:16 +0200 )edit

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.

( 2017-10-29 18:29:58 +0200 )edit

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.

( 2017-10-29 20:01:12 +0200 )edit

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).

( 2017-10-29 21:11:07 +0200 )edit

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.

( 2017-10-30 13:49:14 +0200 )edit