Forum Discussion

FICO's avatar
FICO
Community Manager
7 years ago

Issue with launching mosel from Excel using VBA

Whenever I try to launch Mosel in Excel via VBA I get an runtime error 48, not finding xprm_rt. This happens for own codes as well as for the files from the example repository. Debugging confirms that XPRMinit not accessible / found.

Otherwise, Mosel / Xpress work fine and it is possible to write / read Excel files in Mosel.

My system: Widows 10, Excel 2016, Xpress 7.9.

Any advice on how to resolve this issue would be much appreciated.

Kind regards

David Francas

6 Replies

  • FICO's avatar
    FICO
    Community Manager

    A possible cause for this error message is a bitness mismatch between Excel and Xpress: if you are working with a 32bit Excel then you also need to use the 32bit version of Xpress in order to be able to invoke Mosel via VBA - or otherwise 64bit for both.

  • FICO's avatar
    FICO
    Community Manager

    Dear Susanne,

    thank you for the rapid response. I will try this. Unfortunately, I struggle to find a download / installer for the 32bit version (my academic license is valid for 8.5). So far, i did not receive any repsonse from Fico's support. Can you help me with finding a download / installer for the 32bit version? Thanks.

  • FICO's avatar
    FICO
    Community Manager

    If you have got a full academic license through the Academic Partner Program (APP), then your institution must have been given access to the download page for Xpress where you can find the different software versions. - Please contact the person at your university who has signed up for the program.

  • FICO's avatar
    FICO
    Community Manager

    Dear Susanne,

    Your solution worked, thanks. After switching to the 32 bit version, I was able to use the VBA code provided in ugvba.zip and to connect Mosel to Excel.

  • FICO's avatar
    FICO
    Community Manager

    Dear Susanne,

    since Xpress is not longer supporting 32 bit, is there a workaround to let Xpress (64 bit) work together with Excel 32 bit version when using VBA?

    Thanks

    David

  • FICO's avatar
    FICO
    Community Manager

    Unfortunately there is no straightforward answer to this.

    One possibility how to resolve the bitness mismatch is to work with 2 different versions of Mosel (one full 64bit installation of Xpress with a suitable license for solving the problem type you are interested in + one 32bit version of Xpress - you really just need the Mosel portion of it, eg from Rel8.6 which is the last to provide a 32bit version):

    From your Excel spreadsheet you invoke the 32bit version of Mosel to retrieve the spreadsheet data - just as before - from a new (master) model file that only contains data handling. Once data have been read, your master model copies them to some intermediate location, eg into shared memory (using the shmem: driver of mmjobs). It then needs to open a connection to a 64bit instance of Mosel and run the actual optimization model on this instance with the data provided through the master model. If results are to be written back to the spreadsheet, you transfer them in the inverse direction, from the optimization submodel to the master and from there to the spreadsheet.

    How to work with submodels and data transfer between models is explained in the whitepaper 'Multiple models and parallel solving with Mosel' . You will find the correpsonding example files at https://examples.xpress.fico.com/example.pl?id=runrtpar