In Solver Foundation 2.1 we added very basic support for VBA in the Excel Add-In. By obtaining the MSF add-in COM object you can call Solve, which has the same effect as clicking the “Solve” button in the Solver Foundation Ribbon:
Here is a code sample:
Sub CallSolve() ' Get the MSFForExcel COM object Dim oAddin As COMAddIn Dim oCOMFuncs As Object Set oAddin = Application.COMAddIns("MicrosoftSolverFoundationForExcel") Set oCOMFuncs = oAddin.Object ' Solve oCOMFuncs.Solve End Sub
To access solver results you can write VBA code to access the data in the “Solver Foundation Results” sheet. For cases where the VBA Solve method is insufficient, we recommend writing a VSTO add-in, which allows you to access the full power of Solver Foundation. The Sudoku sample (Documents\Microsoft Solver Foundation\Samples\SolverFoundationServices\VB.NET\Sudoku) shows you how to build a VSTO add-in that uses Solver Foundation.