Cannot get Solver to solve for a target

Creating a macro - Writing a Script - Using the API

Cannot get Solver to solve for a target

Postby BSNatal » Wed Sep 18, 2019 3:48 pm

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 on Windows 10
Posts: 1
Joined: Wed Sep 18, 2019 3:30 pm

Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests