VBA for Numerical Analysis

289 views
Skip to first unread message

Alvin Correa

unread,
Mar 30, 2021, 7:38:57 AM3/30/21
to exce...@googlegroups.com
 Hello everybody. My Name is Alvin Correa. I'm a Mathematical Statistician, and I used two class libraries for VBA.  clsMathParser.cls. This is a mathematical expression interpreter for excel, when you use it, you can introduce a mathematical formula of a function and the library process de function for you. and the other one mMathSpecFun.Bas have a lot of adicional functions. I used these two libraries to build an excel file with some macros to solve some problems of numerical analysis.

The question is, is it possible to incorporate these two libraries to an excel-dna adding? or if anybody has any suggestion to translate it to VB.NET please let me know. 

here in this mail i send you the two libraries and my excel file.  

Thank you very much.
mMathSpecFun.bas
mMathSpecFun.cls
Analisis Numerico y Macros en Excel.xlsm

Govert van Drimmelen

unread,
Apr 4, 2021, 3:57:52 PM4/4/21
to Excel-DNA
Hi Alvin,

I was interested in seeing what it takes to convert a VBA project like this one to VB.NET and Excel-DNA.
It's definitely quite tricky, but I think I've been able to make a good start.
I have a working version of the code in VB.NET and Excel-DNA - at least a version that compiles and seems to draw the right charts.
I'm sure there are some subtle bugs, so to have more confidence in the converted version, one would need to put together a large set of formula examples, and then compare the VBA vs. VB.NET results.

All of this is still quite incomplete, but I have posted to GitHub what I have so far.
To get the code, the easiest would be to open the whole Tutorials repository in Visual Studio, and then go to the right solution file from there.

It's a nice project as an example to perhaps take a bit further too - for example one might use the same expression evaluator in other contexts outside Excel (a console app, a web page or web service) and be sure that it will give the same answers as in Excel.
Also, to write up the changes from VBA to VB.NET is useful for me, so I made some notes on that part here: https://github.com/Excel-DNA/Tutorials/blob/master/VBA-to-.NET/FormulaEvaluateConvert/FormulaEvaluateConvert.md

If you have a look and have further questions, please let me know.
I'll also try to revisit this in future, to make a more complete tutorial or take it a bit further.

-Govert

Alvin Correa

unread,
Apr 13, 2021, 8:21:51 PM4/13/21
to exce...@googlegroups.com
Hello Govert.
Wow this is a titanic work that you made with the translation of the code from VBA to .Net of this two libraries. I will make a few proves with visual studio. and i will give you the feedback. thanks a lot. 

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/b2fae300-9cc2-4ad3-b708-79e49ddc6c96n%40googlegroups.com.

Alvin Correa

unread,
Apr 14, 2021, 6:26:04 PM4/14/21
to Excel-DNA
Hi Govert, I want to test the code to interpret equations but I can't make it work. I want to ask how I do an Excel dna Adding with two or more languages? I mean, if I create a class library for C # and  when I add a Visual Basic file it compiles it very well but the functions that the latter contains do not appear in the Excel AddInn ...

Govert van Drimmelen

unread,
Apr 14, 2021, 6:50:26 PM4/14/21
to exce...@googlegroups.com

Hi Alvin,

 

For every assembly (.dll) that you make, which contains UDF functions, you need to add another <ExternalLibrary Path=… /> entry in the .dna file.

 

-Govert

Reply all
Reply to author
Forward
0 new messages