Ask Your Question

Star basic: passing sub/function as parameter to other sub/function

asked 2020-05-03 13:45:07 +0200

torreone gravatar image

updated 2020-05-03 13:46:29 +0200

Is it possible to pass sub /function A as parameter to other sub /function B as object to be reused in the function B called? Eg:


 display(dum)          ' pass dum to display per reused dum in display


function display (i)
  msgbox (i)
end function

function dum (oFn)
  oFN (0)   
  oFN (1)
end function

It's probably possible using javascript or python (but that's not my goal)

I believe that in star basic it cannot be done (in javascript yes, for example): calling a function B passing a function/sub A leads to execution of A in calling.
But I still ask for confirmation

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-05-03 17:52:08 +0200

JohnSUN gravatar image

You will not receive confirmation. The fact is that in StarBasic it can be done.

Try this C:\fakepath\MacroAsParameter.ods and read this and this

edit flag offensive delete link more


Fantastic !! Very thanks !!!

I vaguely knew macro uri, but I never thought it could be applied to this problem.

For a LO macro programmer is an important help

Thank you so much again

torreone gravatar imagetorreone ( 2020-05-03 20:01:57 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-05-03 13:45:07 +0200

Seen: 98 times

Last updated: May 03 '20