×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Old Windows 95 Excel macro convert to new Excel 2000

Old Windows 95 Excel macro convert to new Excel 2000

Old Windows 95 Excel macro convert to new Excel 2000

(OP)
I found one spreadsheet using old Windows 95 Excel macro. I tried to run the macro, there was a run-time error

Run-time error “1004”

Your program contains an invalid external reference to a worksheet
Verify the path, workbook, and range name or cell reference are correct, and try again


Sub RunSolver()
Application.ExecuteExcel4Macro String:= _
    "[SOLVER.XLA]SOLVER!SOLVER.SOLVE()"
    Call Constraints
End Sub

The error message is highlighted as
"Application.ExecuteExcel4Macro String:=
  "[SOLVER.XLA]SOLVER!SOLVER.SOLVE()"

Could anyone tell me how to correct it (using MS Excel 2000)? I notice that new Solver library uses SOLVER32.DLL and SOLVER.XLA. (the old file Windows 95 uses SOLVER.DLL and SOLVER.XLA)

If the above "Application.ExecuteExcel4Macro String:=...." needs to be rewrite, how to do it?

Thanks

RE: Old Windows 95 Excel macro convert to new Excel 2000

Check the visual basic help for xl2000.  Here's an excerpt from the help text I found:

SolverSolve Function
        

Begins a Solver solution run. Equivalent to clicking Solve in the Solver Parameters dialog box.

Before you use this function, you must establish a reference to the Solver add-in. With a Visual Basic module active, click References on the Tools menu, and then select the Solver.xla check box under Available References. If Solver.xla doesn't appear under Available References, click Browse and open Solver.xla in the \Office\Library subfolder.

Syntax

SolverSolve(UserFinish, ShowRef)

UserFinish   Optional Variant. True to return the results without displaying the Solver Results dialog box. False or omitted to return the results and display the Solver Results dialog box.

ShowRef   Optional Variant. Used only if True is passed to the StepThru argument of the SolverOptions function. You can pass the name of a macro (as a string) as the ShowRef argument. This macro is then called whenever Solver returns an intermediate solution.

SolverSolve Function Example

This example uses the Solver functions to maximize gross profit in a business problem. The SolverSolve function begins the Solver solution run.

Worksheets("Sheet1").Activate
SolverReset
SolverOptions Precision:=0.001
SolverOK SetCell:=Range("TotalProfit"), _
    MaxMinVal:=1, _
    ByChange:=Range("C4:E6")
SolverAdd CellRef:=Range("F4:F6"), _
    Relation:=1, _
    FormulaText:=100
SolverAdd CellRef:=Range("C4:E6"), _
    Relation:=3, _
    FormulaText:=0
SolverAdd CellRef:=Range("C4:E6"), _
    Relation:=4
SolverSolve UserFinish:=False
SolverSave SaveArea:=Range("A33")

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources