Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Tools > References...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gary''s Student - 31 May 2008 17:14 GMT
I distributed a macro that uses Solver.  I supplied instructions to the users
to make sure the Solver checkbox in Tools > References... was checked before
trying the macro.

A significant number of people called saying the macro did not work (meaning
they ignored the instructions).

Is there any way for the macro to switch on the reference itself??
Signature

Gary''s Student - gsnu2007xx

Norman Jones - 31 May 2008 17:32 GMT
Hi Gary,

See Dana de Louis's code posted
by Tom Ogilvy:

       How to run Solver from Visual Basic?
       http://tinyurl.com/6fvkaz

---
Regards.
Norman

>I distributed a macro that uses Solver.  I supplied instructions to the
>users
[quoted text clipped - 7 lines]
>
> Is there any way for the macro to switch on the reference itself??
Gary''s Student - 31 May 2008 18:24 GMT
Thank you
Signature

Gary''s Student - gsnu200789

> Hi Gary,
>
[quoted text clipped - 19 lines]
> >
> > Is there any way for the macro to switch on the reference itself??
Dave Peterson - 31 May 2008 17:33 GMT
From a Rob Bovey post:

   The Application.Run approach is the one I would suggest. It doesn't
require a reference to the Solver add-in, but it does require that the
Solver add-in be open in Excel and that the calls to Solver procedure names
be fully qualified, e.g.:

   Application.Run "Solver.xla!SolverSolve", False

   Because Solver is a demand-loaded add-in, you have to do something a
little strange to make sure it's actually open in the user's instance of
Excel. Run the following two lines of code prior to calling any Solver
procedures:

       Application.AddIns("Solver Add-in").Installed = False
       Application.AddIns("Solver Add-in").Installed = True

The reason for this is that if the user already has Solver selected under
Tools/Add-ins when they open Excel, Excel will consider the add-in loaded
even though Solver.xla doesn't actually open until you select its menu.
Explicitly unloading it and then reloading it in VBA forces Solver.xla to
open no matter what the user's initial settings were.

> I distributed a macro that uses Solver.  I supplied instructions to the users
> to make sure the Solver checkbox in Tools > References... was checked before
[quoted text clipped - 6 lines]
> --
> Gary''s Student - gsnu2007xx

Signature

Dave Peterson

Gary''s Student - 31 May 2008 18:24 GMT
Thanks
Signature

Gary''s Student - gsnu200789

> From a Rob Bovey post:
>
[quoted text clipped - 29 lines]
> > --
> > Gary''s Student - gsnu2007xx
RB Smissaert - 31 May 2008 17:51 GMT
Try this one. Note that this doesn't need a reference to the VBE
Extensibility.

Sub SolverInstall()

 Dim oWB As Workbook
 Dim strSolverPath As String

 On Error Resume Next

 Set oWB = ActiveWorkbook

 strSolverPath = Application.LibraryPath & "\SOLVER\SOLVER.XLA"

 'to load the .xla
 With AddIns("Solver Add-In")
   .Installed = False
   .Installed = True
 End With

 'to set the reference
 oWB.VBProject.References.AddFromFile strSolverPath

End Sub

RBS

>I distributed a macro that uses Solver.  I supplied instructions to the
>users
[quoted text clipped - 7 lines]
>
> Is there any way for the macro to switch on the reference itself??
Gary''s Student - 31 May 2008 18:24 GMT
Thanks!
Signature

Gary''s Student - gsnu200789

> Try this one. Note that this doesn't need a reference to the VBE
> Extensibility.
[quoted text clipped - 34 lines]
> >
> > Is there any way for the macro to switch on the reference itself??
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.