Eval Method

Back to Methods Reference

Evaluates an expression in VBA.


VBA : object.Eval(Expression)

VL : (val-Eval Expression)

(vla-eval applic (strcat "MsgBox \"Hello Everybody\"" ", "  "vbInformation" ", " "\"AfraLisp\""))

  • Object : Application
    The object or objects this method applies to.
  • Expression : String; input-only
    The expression to be evaluated.


This method allows Automation clients to execute a line of VBA code in the context of the current project without creating modules and functions.

Example :

(defun c:al-eval ()


(setq applic (vlax-get-acad-object))

(vla-eval applic (strcat "MsgBox \"Hello Everybody\"" ", "
 "vbInformation" ", " "\"AfraLisp\""))

(vla-eval applic (strcat "MsgBox \"Are You Fine?\"" ", "
"vbQuestion" ", " "\"CAD Encoding\""))

(vla-eval applic (strcat "MsgBox \"Or, are you not Well?\"" ", "
"vbCritical" ", " "\"VBA Expresso\""))

(alert "\nAnd this is the boring\nAutoCAD message box!!")



The AutoLisp/Visual Lisp/VBA Resource Website
Search the WWW Search AfraLisp

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website