ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use Excel as Maath Engine for VS.NET (https://www.excelbanter.com/excel-programming/276443-use-excel-maath-engine-vs-net.html)

andrew

Use Excel as Maath Engine for VS.NET
 
I am trying to use the Excel object to perform
calculations within a VB.NET program.
I set an Excel object, pass a string argument to its
evaluate method and all seems to work OK until I try and
pass an array.
i.e

this works when S= "cos(3.673/4)/exp(-3.33)"
Dim xL As New Excel.Application
Dim B As String
B = xL._Evaluate(S).ToString

this doesn't when S = "Sum({1,2,3,4,5})
Dim xL As New Excel.Application
Dim B As String
B = xL._Evaluate(S).ToString

Any one got ideas???


Rob Bovey

Use Excel as Maath Engine for VS.NET
 
Hi Andrew,

The following works fine for me:

MessageBox.Show(xlApp.Evaluate("SUM({1,2,3,4,5})") .ToString)

where xlApp is an running instance of the Excel Application object.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"andrew" wrote in message
...
I am trying to use the Excel object to perform
calculations within a VB.NET program.
I set an Excel object, pass a string argument to its
evaluate method and all seems to work OK until I try and
pass an array.
i.e

this works when S= "cos(3.673/4)/exp(-3.33)"
Dim xL As New Excel.Application
Dim B As String
B = xL._Evaluate(S).ToString

this doesn't when S = "Sum({1,2,3,4,5})
Dim xL As New Excel.Application
Dim B As String
B = xL._Evaluate(S).ToString

Any one got ideas???





All times are GMT +1. The time now is 10:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com