LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Launching solver in new Excel Instance

Hi,

I am trying to launch the excel Solver from a macro of workbook1 of an
excel instance MyXL1 in a workbook2 of another excel instance MyXL2,
and I cannot seem to get this right (the solver launches in the first
workbook)

I guess i have to add a reference to the workbook2 for SolverOK and
SolverAdd but how can I do that ??

Thank you in advance for any help you can give me!!!


With WorkBook1.VBProject.VBComponents("ForSolver").Code Module
NewCode = .Lines(1, .CountOfLines)
End With
With Workbook2.VBProject.VBComponents("ThisWorkbook").C odeModule
.DeleteLines 1, .CountOfLines
.AddFromString NewCode
End With
'copies a workbook_sheetselectionchange event that opens the solver
reference in the library

SolverReset

SolverOk SetCell:=Workbook2.ActiveSheet.Range("AT28:AT28"),
MaxMinVal:=3, ValueOf:="0",
ByChange:=Workbook2.ActiveSheet.Range(Workbook2.Ac tiveSheet.Cells(DebutPlage,
9), Workbook2.ActiveSheet.Cells(FinPlage, 9))

solveroptions Precision:=0.1
solveroptions Iterations:=10

For i = 18 To 29
SolverAdd CellRef:=Workbook2.ActiveSheet.Cells(28, i), Relation:=3,
FormulaText:="0"
Next i


Workbook2..ActiveSheet.Range("AT28:AT28").Select

MyXL.Application.Run "Solver.xla!SolverSolve"

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Launching Excel RichD Setting up and Configuration of Excel 2 December 20th 07 02:29 AM
Launching Excel TelAb Excel Discussion (Misc queries) 2 June 9th 07 07:35 PM
Launching Excel wllee Excel Discussion (Misc queries) 4 August 31st 05 01:05 AM
Launching Excel programmatically not the same as launching excel manually Atchoum Excel Programming 2 November 24th 04 06:24 PM
Launching Excel mercury Excel Programming 0 November 19th 03 02:24 PM


All times are GMT +1. The time now is 10:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"