Decision Optimization

 View Only
Expand all | Collapse all

Running CPLEX using excel vba

  • 1.  Running CPLEX using excel vba

    Posted Wed December 01, 2021 04:52 PM
    I have an excel file that i would like to use as an interface to running a CPLEX problem. I have tried to use the shell function on vba so that i could run my cplex model but i doesn't seem to be working. I used the following code:

    Public Sub callCPLEX()

    MsgBox ("External call to OPL")

    Dim strPath As String

    strPath = "C:\ILOG\CPLEX_Studio1210\opl\bin\x64_win64\oplrun.exe C:\Diretorio MOADE\Trabalho_v2\Trabalho_v2.mod C:\Diretorio MOADE\Trabalho_v2\Trabalho_v2.dat"

    Shell strPath

    End Sub

    But nothing happens, as CPLEX isn't opened and the mod file isn't runned.

    Thank you!

    Beatriz Santos

  • 2.  RE: Running CPLEX using excel vba

    Posted Thu December 02, 2021 04:44 AM

    the example How to call OPL from Excel ? in Excel and OPL  works fine


    [Alex] [Fleischer]
    [EMEA CPLEX Optimization Technical Sales]