OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How can I translate the VBA function evaluate() to BASIC

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
SandroV
Newbie
Newbie


Joined: 03 Apr 2007
Posts: 1

PostPosted: Tue Apr 03, 2007 8:15 am    Post subject: How can I translate the VBA function evaluate() to BASIC Reply with quote

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
View user's profile Send private message
TerryE
Super User
Super User


Joined: 16 Jul 2006
Posts: 550
Location: UK

PostPosted: Wed Apr 04, 2007 4:22 pm    Post subject: Reply with quote

OOo Basic doesn't include a an evaluate function, which is a real shame, but see
http://www.oooforum.org/forum/viewtopic.phtml?t=18781
for a way of using library insertion to do this, and if you are really desperate you can always call vbscript from inside your code *if* you are running under windows of course; see
http://www.oooforum.org/forum/viewtopic.phtml?p=19121
_________________
Terry
WinXPSP3, OOo 2.4.1, Ubunto 8.04 for development
Also try the Official OOo Community Forum where I mainly post now.
Back to top
View user's profile Send private message Visit poster's website
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Fri Apr 06, 2007 4:32 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group