Ask Your Question
0

CalcBASIC: How to move cursor to 4 directions ?

asked 2019-12-02 10:17:11 +0100

lonk gravatar image

updated 2019-12-02 10:19:34 +0100

In MS Excel VBA, they do like this.

And in LO Calc BASIC, how can we do like that ?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2019-12-02 13:50:35 +0100

Lupp gravatar image

I don't really know VBA for Excel, but it may well support lots of solutions because it seems to map the working of Excel deeply, and Excel support encourages the usage of macros even where they are more or less obsolete. This may be part of MS' incompatibility strategy. LibreOffice Basic never tried to do so. It is only one of many programming languages you can use with LibreOffice because the relevant services and interfaces are cared for by an API. In Addition the Basic only contains a few predefined variables and specialized types. And: Generally the usage of macros is less emphasized.

Well, there is the Option VBAsupport 1, but there will always be limits to its power. If you then start to combine VBA programming with native LibreOffice API usage there will be conflicts - technical as well as mental (concerning the user).

Just two examples concerning spreadsheets:
VBA places the row index first if a position is given. LibreOffice API has the column index in this place.
VBA starts indexing with 1, LibreOffice starts with 0.

To learn about additional basical differences you may study this attached example containing some Basic code.
If you come to the conclusion that programming for LibO isn't what you want to learn, sticking to VBA should be expected to drift you back into the realm of MS. Omitting macros wherever possible may help.

edit flag offensive delete link more
1

answered 2019-12-02 11:14:57 +0100

Opaque gravatar image

updated 2019-12-02 11:20:01 +0100

Hello

you could do it the same way if using Option VBASupport 1 at the beginning of your Basic Modul (i.e. before any Sub or Function statement).

Example that worked for me:

Option VBASupport 1

Sub DownOne
  ActiveCell.Offset(1, 0).Select
  Selection.Value = "Hello lonk"
End Sub

Tested using LibreOffice:

Version: 6.3.3.2, Build ID: a64200df03143b798afd1ec74a12ab50359878ed
CPU threads: 8; OS: Linux 4.12; UI render: default; VCL: kde5;
Locale: en-US (en_US.UTF-8); UI-Language: en-US, Calc: threaded
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-12-02 10:17:11 +0100

Seen: 25 times

Last updated: Dec 02