I am looking for a code that would automatically include reference to an Excel macro.
Currently, I need to go to Tools-References in VBA to include a reference. But, maybe, there is a way to code this?
the only problem is that I can not add a reference and execute a function from the reference in the same sub. But this is fine - I can put them into different macros and run sequentially.
Here is what I have:
---- add the reference on SOLVER
Sub ss3()
With ThisWorkbook.VBProject.References
.AddFromFile "C:\ProgramFiles\MicrosoftOffice\Offi ce10\Library\Solver\SOLVER.XLA"
End With
End Sub
----- run solver
Sub ss4()
'set objective function
SolverOk SetCell:="$B$6", MaxMinVal:=2,ValueOf:="0", ByChange:="$B$1:$B$3"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.