locked
Is there a Library to implement VBA in my application? RRS feed

  • Question

  • Hi,

    I am developing a program in VB.NET. I would like to implement the possibility to use small vba scripts in my tool. Users should be able write some VBA code, lets say FunctionResult = x + y. I then want to get the result in my Code with Eval. I've done something similar with vb script but as this is often disabled in cusomer envorionments I cannot use this any longer. 

    I read that a lot of programs support VBA (ArcGIS, AutoCad, CorelDraw etc.), so I thought there might be some library / dll that I could license / implement to support VBA in my application.

    But I can't find anything useful on the web, or I am not smart enough to use the right words in the search.

    Any hints would be highly appreciated, thank you very much.

    Kind regards

    Norman

    Wednesday, December 9, 2020 7:21 AM

All replies

  • MS started licensing VBA around 2000 to large companies.  They discontinued licensing in 2007.  You call VB from VBA using COM .NET DLLs.  You can use VSTO or NetOffice to call VBA from VB or C#.  I've used NetOffice using C# for a small app.  NetOffice is more flexible, it isn't Excel version specific.

    Public Function tesFn(ByVal i As Integer, ByVal j As Integer) As Integer
        tesFn = i + j
    End Function
    
    
    VSTO call
    Dim answer As Integer = Me.Application.Run("tesFn", 10, 5)


    Monday, December 14, 2020 10:20 PM