| View previous topic :: View next topic |
| Author |
Message |
SandroV Newbie

Joined: 03 Apr 2007 Posts: 1
|
Posted: Tue Apr 03, 2007 8:15 am Post subject: How can I translate the VBA function evaluate() to BASIC |
|
|
I'm translating many macros from VBA to openoffice basic: the only my
problem is to translate the VBA function evaluate(....), for example
x="3*8+4^2".
y=Evaluate(x)
I need this function since I have to show the details of my calculations.
I've solved the problem as follow:
Function cal(testo As String) As Double
oObjFactory = createUnoService( "com.sun.star.bridge.OleObjectFactory" )
RInterface = oObjFactory.createInstance(
"StatConnectorSrv.StatConnector" )
call RInterface.Init("R")
cal = RInterface.Evaluate(testo)
End Function
BUT IN THIS WAY MY CALC SHEETS ARE VERY SLOW !!!!!
Is there a easy way to do it????
Thank you in advance
Sandro |
|
| Back to top |
|
 |
TerryE Super User

Joined: 16 Jul 2006 Posts: 550 Location: UK
|
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1355
|
Posted: Fri Apr 06, 2007 4:32 am Post subject: |
|
|
an alternative solution would be to use the javascript eval function. For an example how to call javascript from OOBasic see http://www.oooforum.org/forum/viewtopic.phtml?t=21564
BTW, what is the "StatConnectorSrv.StatConnector" ? I did not find that in my (Windows XP) registry ?
ms777 |
|
| Back to top |
|
 |
|