Search code examples
libreoffice-calclibreoffice-basic

Line Code break " _" in StarBasic Macros of LibreCalc do not work in quoted string


Line Code break " _" in StarBasic Macros of LibreCalc do not work in quoted string

So how i can escape in quotes line-continuation character " _"?

eg.

Const SCells = "B17:C28,E17:G28,L17:O28,T17:V28,AA17:AE28,AN17:AR28, _
BB17:BD28,BO17:BS28,BY17:CB28,CG17:CI28,CS17:CW28,DB17:DF28,DL17:DN28, _
DU17:DX28,EF17:EK28,ET17:EV28,FA17:FD28,FJ17:FL28,FV17:FZ28,GD17:GF28, _
GM17:GO28"
splitCells = Split(SCells,",")

sub Cells_range

for i = 0 to 2 step 1

print splitCells(i)

next i

end sub

Solution

  • Yes, correct syntactic is

    Const SCells = "B17:C28,E17:G28,L17:O28,T17:V28,AA17:AE28,AN17:AR28," & _
        "BB17:BD28,BO17:BS28,BY17:CB28,CG17:CI28,CS17:CW28,DB17:DF28,DL17:DN28," & _
        "DU17:DX28,EF17:EK28,ET17:EV28,FA17:FD28,FJ17:FL28,FV17:FZ28,GD17:GF28," & _
        "GM17:GO28"
    
    Sub  Cells_range
        splitCells = Split(SCells,","), etc.
    

    Pay attention - the calculation of splitCells = ... is written inside the procedure