Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.
Function CheckSolver() As Boolean 'Found solution to Solver issue online in Google search ' Peltier Technical Services, Inc., Copyright © 2007. All rights reserved. ' Returns True if Solver can be used, False if not. Dim bSolverInstalled As Boolean ' Assume true unless otherwise CheckSolver = True On Error Resume Next ' check whether Solver is installed bSolverInstalled = Application.AddIns("Solver Add-In").Installed Err.Clear If bSolverInstalled Then ' uninstall temporarily Application.AddIns("Solver Add-In").Installed = False ' check whether Solver is installed (should be false) bSolverInstalled = Application.AddIns("Solver Add-In").Installed End If If Not bSolverInstalled Then ' (re)install Solver, should be gone Application.AddIns("Solver Add-In").Installed = True ' check whether Solver is installed (should be true) bSolverInstalled = Application.AddIns("Solver Add-In").Installed End If If Not bSolverInstalled Then MsgBox "Solver was not found. This workbook will not work properly Solver addin is installed.", vbCritical CheckSolver = False End If If CheckSolver Then Dim solverProg As String On Error Resume Next ' turn on error handler 'Next line needed to deal/remove unexspected memory error. Application.Run "Solver.xla!Solver.Solver2.Auto_open" 'Application.Run "Solver.xla!Auto_Open" If Err.Number <> 0 Then 'solver.xla error occurred, use solver.xlam instead solverProg = "Solver.xlam" Application.Run solverProg + "!Solver.Solver2.Auto_open" 'MsgBox "File found and will used Solver.xlam " If Err.Number <> 0 Then MsgBox ("Solver.xla or Solver.xlam not found. Exiting.") ' or whatever message you want to use 'Exit Sub End If Else 'solver.xla ran successfully solverProg = "Solver.xla" 'MsgBox "File found and will use Solver.xla " End If End If On Error GoTo 0 End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Compiling a Excel Spreadsheet/Workbook||11||66|
|Excel VBA - Import Mail Headers in Excel from Specific Folder||3||37|
|sort time order||10||39|
|Save PowerPoint from Active Workbook Excel VBA||5||25|
Join the community of 500,000 technology professionals and ask your questions.