GLPK/Visual Basic for Applications

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Visual Basic for Applications (VBA) is a scripting language used in Microsoft Office and software packages.

GLPK for Windows[edit | edit source]

GLPK for Windows provides multiple examples demonstrating calling the GLPK library with Visual Basic for Applications. It is licensed under GPL V3.

To run the examples follow the steps below:

  • Open Excel
  • Either press ALT+F11 or select menu entry Developer -> View code.
  • With menu entry File -> Import File import the modules.
  • In glpk.bas replace "glpk.dll" with the full path to the relevant dll. For version 4.63 this is:
    • w32/glpk_4_63_stdcall.dll for 32bit Windows,
    • w64/glpk_4_63.dll for 64bit Windows.
  • Press CTRL+G or select menu entry View -> Immediate Window.
  • Press F5 to run an example. The output is shown in the immediate window.
  • To run gmpl.bas call function gmpl_main passing the name of a GMPL model file as parameter.

References[edit | edit source]