PDA

View Full Version : Solver VBA reference in non-english Excel



Nuz
07-19-2012, 02:32 PM
I need to add VBA reference to solver programmatically when the user opens the Excel-file (Excel 2010 is used). For that I use:

ThisWorkbook.VBProject.References.AddFromFile Application.LibraryPath _
& Application.PathSeparator & "SOLVER" & Application.PathSeparator & "SOLVER.XLAM"
What if the user doesn't have english version of Excel installed but some other languague? Will the above code fail, i.e. the SOLVER dll-file is not "SOLVER.XLAM" but something else?

One of my users is getting "Compile error in hidden module"-error and I suspect that this line causes it.