Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleEvaluate mathematical expressions using Excel's Evaluate function
Keywordsreplace, character, remove, unwanted
CategoriesUtilities, Strings
 
A previous example shows how to evaluate an expression by writing it into an Excel cell. Kent Finkle points out that you can use Excel's Evaluate function without even creating a worksheet.
 
Private Sub cmdEvaluate_Click()
Dim excel_app As Object

    Set excel_app = CreateObject("Excel.Application")

    ' Uncomment this line to make Excel visible.
'    excel_app.Visible = True

    ' Get the result.
    lblResult.Caption = _
        excel_app.Evaluate(txtExpression.Text)

    ' Comment the rest of the lines to keep
    ' Excel running so you can see it.

    ' Close Excel.
    excel_app.Quit
    Set excel_app = Nothing
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated