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
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
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).
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
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.