View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Martien Janssen[_2_] Martien Janssen[_2_] is offline
external usenet poster
 
Posts: 3
Default Solver reference problem

I am using a workbook with VBA code referring to the Excel solver. When I
transfer the workbook to a different PC, I may get problems as the reference
may get broken due to a different location of the solver.xla file. Is there
a way to handle this without involving the user of the workbook ? I have
added the following code:

solverpath = Application.Librarypath & "\solver\solver.xla"
ThisWorkbook.VBProject.References.AddFromFile solverpath

This gives a problem since the solver is already referenced initially.
Somehow, I have to dereference the solver first and then follow the above
instructions, but I don't know how. I tried with
ThisWorkbook.VBProject.References.Remove (xxx) but do not know how to code
xxx ?

Any ideas,

Martien
PS I am using Excel 97.