Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Using the addin solver inside a macro

When I record a macro that invokes the addin function solver and then
run the macro I get the following error, "Sub or Function not
defined". I know the solver works because I can run it manually.
Help. Can the solver be run inside a macro?

TerryM
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using the addin solver inside a macro

You need to set a reference to solver in Tools=References in the VBE.

Here is an article to look at:

http://support.microsoft.com/support...ver/solver.asp
Creating Visual Basic Macros that Use Microsoft Excel Solver

if you want to set the reference with code, here is some code posted by Dana
DeLouise

http://groups.google.com/groups?thre...gp13 .phx.gbl

Sub SolverInstall()
'// Dana DeLouis
Dim wb As Workbook

On Error Resume Next
' 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
End Sub


This line adds the reference:
wb.VBProject.References.AddFromFile .FullName

The other parts make sure it is loaded as an addin.
--
Regards,
Tom Ogilvy

"TerryM" wrote in message
om...
When I record a macro that invokes the addin function solver and then
run the macro I get the following error, "Sub or Function not
defined". I know the solver works because I can run it manually.
Help. Can the solver be run inside a macro?

TerryM



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
When do you improve the solver addin??? Solver Excel Worksheet Functions 1 December 22nd 06 06:23 PM
Question about the Solver Addin Mark Excel Discussion (Misc queries) 3 July 13th 06 01:29 PM
Solver and Addin A.D. Excel Discussion (Misc queries) 1 December 15th 05 12:13 PM
Solver Addin Faranak Negahdar Excel Discussion (Misc queries) 1 June 30th 05 07:33 PM
Excel solver addin. kotharu Excel Programming 4 November 5th 03 07:13 PM


All times are GMT +1. The time now is 01:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"