Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to add a reference to solver
I what a piece of VBA code that will add a reference to solver.
I would put it in a sub or function that uses solver Thank -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to add a reference to solver
http://support.microsoft.com/?id=160647
XL97: How to Programmatically Create a Reference -- Regards, Tom Ogilvy "Tbeek " wrote in message ... I what a piece of VBA code that will add a reference to solver. I would put it in a sub or function that uses solver Thanks --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to add a reference to solver
I would like to create the reference to solver in VBA that would b
equivalent to: From the Visual Basic Editor, Tools, References, CheckMark Solver click OK. I am making a function that uses solver and I want to distribute it t my colleagues but I don't want to have to go to their pc and tur solver on and reference it. I would like the function to do it befor it calls solver. If there was a good way to check that solver was installed an referenced, I could also use that so the function wouldn't have t install and reference solver every time the function was used in worksheet -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to add a reference to solver
Sub SolverInstall()
On Error Resume Next Dim wb As Workbook Dim SolverPath As String ' Set a Reference to the workbook that will hold Solver Set wb = ActiveWorkbook SolverPath = Application.LibraryPath & "\SOLVER\SOLVER.XLA" With AddIns("Solver Add-In") .Installed = False .Installed = True End With 'Solver itself has 'focus' at this point. 'Make sure you point to the correct Workbook for Solver wb.VBProject.References.AddFromFile SolverPath End Sub HTH. :) -- Dana DeLouis Using Windows XP & Office XP = = = = = = = = = = = = = = = = = "Tbeek " wrote in message ... I what a piece of VBA code that will add a reference to solver. I would put it in a sub or function that uses solver Thanks --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to add a reference to solver
Read the article - it tells you how to create a reference programmatically.
Knowing that, you should be able to adapt it to create a specific reference for solver. Giving a dick and jane explantion of what you want to do is unnecessary as you already stated what you wanted to do in your original question. Using the information in the article would also give you the insights to determine if the reference already exists. You would just loop through the references collection and test if any of the references are for solver (and that if so, it isn't broken). -- Regards, Tom Ogilvy "Tbeek " wrote in message ... I would like to create the reference to solver in VBA that would be equivalent to: From the Visual Basic Editor, Tools, References, CheckMark Solver, click OK. I am making a function that uses solver and I want to distribute it to my colleagues but I don't want to have to go to their pc and turn solver on and reference it. I would like the function to do it before it calls solver. If there was a good way to check that solver was installed and referenced, I could also use that so the function wouldn't have to install and reference solver every time the function was used in a worksheet. --- Message posted from http://www.ExcelForum.com/ |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to add a reference to solver
You may prefer this other version that I use. HTH. :)
Sub SolverInstall() '// Dana DeLouis Dim wb As Workbook On Error Resume Next ' Set a Reference to the workbook that will hold Solver Set wb = ActiveWorkbook With wb.VBProject.References .Remove .Item("SOLVER") End With With AddIns("Solver Add-In") .Installed = False .Installed = True wb.VBProject.References.AddFromFile .FullName End With End Sub -- Dana DeLouis Using Windows XP & Office XP = = = = = = = = = = = = = = = = = "Dana DeLouis" wrote in message ... Sub SolverInstall() On Error Resume Next Dim wb As Workbook Dim SolverPath As String ' Set a Reference to the workbook that will hold Solver Set wb = ActiveWorkbook SolverPath = Application.LibraryPath & "\SOLVER\SOLVER.XLA" With AddIns("Solver Add-In") .Installed = False .Installed = True End With 'Solver itself has 'focus' at this point. 'Make sure you point to the correct Workbook for Solver wb.VBProject.References.AddFromFile SolverPath End Sub HTH. :) -- Dana DeLouis Using Windows XP & Office XP = = = = = = = = = = = = = = = = = "Tbeek " wrote in message ... I what a piece of VBA code that will add a reference to solver. I would put it in a sub or function that uses solver Thanks --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Solver formula "Equal to Value of:" cell reference | Excel Discussion (Misc queries) | |||
Interesting Solver problem (Solver encounters an error) | Excel Discussion (Misc queries) | |||
Solver code does not save results to sheet - What am I missing?! | Excel Programming | |||
access the solver reference library | Excel Programming | |||
Reference a Column in Code | Excel Programming |