D
David Adamson
Greetings,
I developed a set of solver equations and used the follwoing code to fire
them up for re-analysis.
I set all the values using solver itself in the worksheets and was just
using the code to reactivate the equations after I changes some data.
However after I ran the code and I wanted to double check a couple of
things. So when trying to view the solver equation in the worksheet I
recived a messge that effectively said "Solver32.dll is missing and its
needs to be reinstalled via the CD"
I was wondering if this was caused by my poor coding ability when trying to
set a reference and if so how can I advoid this. As the code appears to
still work yet I can't get it to fire manually when I'm in a spreadsheet.
thanks is advance
The code used is
Private Sub RunModel_Click()
Dim x As Integer
Dim Catch As String
Dim wb As Workbook
MsgBox "Updating Catchment Data"
Call Load_Catch_Data
MsgBox "Finished Updating"
On Error Resume Next ' Adapted from Dana DeLouise's article
' 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
MsgBox "Running solver. Please wait"
For x = 1 To 20
Catch = "Catch" & x
With Worksheets(Catch)
..Activate
solverok
solversolve userfinish:=True
solverfinish keepfinal:=1
End With
Next x
MsgBox "Finished running solver. Heading to results"
End sub
I developed a set of solver equations and used the follwoing code to fire
them up for re-analysis.
I set all the values using solver itself in the worksheets and was just
using the code to reactivate the equations after I changes some data.
However after I ran the code and I wanted to double check a couple of
things. So when trying to view the solver equation in the worksheet I
recived a messge that effectively said "Solver32.dll is missing and its
needs to be reinstalled via the CD"
I was wondering if this was caused by my poor coding ability when trying to
set a reference and if so how can I advoid this. As the code appears to
still work yet I can't get it to fire manually when I'm in a spreadsheet.
thanks is advance
The code used is
Private Sub RunModel_Click()
Dim x As Integer
Dim Catch As String
Dim wb As Workbook
MsgBox "Updating Catchment Data"
Call Load_Catch_Data
MsgBox "Finished Updating"
On Error Resume Next ' Adapted from Dana DeLouise's article
' 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
MsgBox "Running solver. Please wait"
For x = 1 To 20
Catch = "Catch" & x
With Worksheets(Catch)
..Activate
solverok
solversolve userfinish:=True
solverfinish keepfinal:=1
End With
Next x
MsgBox "Finished running solver. Heading to results"
End sub