Cannot get Solver to solve for a target

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
BSNatal
Posts: 1
Joined: Wed Sep 18, 2019 3:30 pm

Cannot get Solver to solve for a target

Post 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 
Last edited by MrProgrammer on Wed Sep 18, 2019 6:50 pm, edited 3 times in total.
Reason: Split from solved topic 16980: Solver macro
Using LibreOffice 6.3.1.2 on Windows 10
Post Reply