Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I created a file which is going to be used by many people that uses SOLVER -- I put in code that I obtained from a site (Jon Peltier's site) that automatically installs SOLVER every time the file is opened (the code is within a module that is called in the Private Sub Workbook_Open()). The issue is that when I sent the file to a user and the user sent the file back to me (after inputting data into the file and using SOLVER), when I open the file, I get the following error: "Compile error: Can't find project of library" Below is the code -- the line of code preceded by ** is the line that is highlighted when the error comes up (8 lines down). Does anyone have any idea on why this would occur? Public Function CheckSolver() As Boolean '' Adjusted for Application.Run() to avoid Reference problems with Solver '' Peltier Technical Services, Inc., Copyright © 2007. All rights reserved. '' Returns True if Solver can be used, False if not. Dim bSolverInstalled As Boolean ** If gbDebug Then Debug.Print Now, "CheckSolver " '' 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 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 not found. This workbook will not work.", vbCritical CheckSolver = False End If If CheckSolver Then ' initialize Solver Application.Run "Solver.xla!Solver.Solver2.Auto_open" End If On Error GoTo 0 End Function Public Function CheckAntoolpak() As Boolean '' Adjusted for Application.Run() to avoid Reference problems with Analysis ToolPak '' Peltier Technical Services, Inc., Copyright © 2007. All rights reserved. '' Returns True if Analysis ToolPak can be used, False if not. Dim bantoolpakInstalled As Boolean If gbDebug Then Debug.Print Now, "Checkantoolpak " '' Assume true unless otherwise CheckAntoolpak = True On Error Resume Next ' check whether Analysis ToolPak is installed bantoolpakInstalled = Application.AddIns("Analysis ToolPak").Installed Err.Clear If bantoolpakInstalled Then ' uninstall temporarily Application.AddIns("Analysis ToolPak").Installed = False ' check whether Analysis ToolPak is installed (should be false) bantoolpakInstalled = Application.AddIns("Analysis ToolPak").Installed End If If Not bantoolpakInstalled Then ' (re)install Analysis ToolPak Application.AddIns("Analysis ToolPak").Installed = True ' check whether Analysis ToolPak is installed (should be true) bantoolpakInstalled = Application.AddIns("Analysis ToolPak").Installed End If If Not bantoolpakInstalled Then MsgBox "Analysis ToolPak not found. This workbook will not work.", vbCritical CheckAntoolpak = False End If If CheckAntoolpak Then ' initialize Analysis ToolPak Application.Run "Analysis ToolPak.xla!Analysis ToolPak.Auto_open" End If On Error GoTo 0 End Function -- Robert |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to have a macro simply issue the "find" command or "control f: | Excel Programming | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Revisiting "New issue with "With" statment" post from 6/7/07 | Excel Programming | |||
Tools...References shows "MISSING:" in front of 2 references | Excel Programming | |||
References.Remove References(1) DOES NOT WORK for "MISSING:" Refs | Excel Programming |