Page 1 of 1

Cannot get Solver to solve for a target

PostPosted: Wed Sep 18, 2019 3:48 pm
by BSNatal
I am also a new LibreOffice Windows 10 macro user - moving from Excel, but I have found the macros more difficult to write. At the moment I am trying to get solver to work with a macro. The code given in earlier part of the thread works for maximise, but I cannot get solver to solve for a target. It seems to run, but does not save any correct result. Is it something I have incorrect in the code, or is there a bug?

The relevant section of code I have is:

' Get objective from cell D3
solv.Objective = Sheet.getCellByPosition(3,2).CellAddress ' does not work with the uno call
solv.Maximize = False
solv.Solve() 'Seems to work and indicates the correct value but was not saving values
' dispatcher.executeDispatch(document, ".uno:SolverDialog", "", 0, Array()) 'uno call works to start solver but does not set constraints or objective

I would value any assistance
 Edit: Split from Solver macro; This situation is different and needs a new topic