Evaluates an expression in VBA.
Supported platforms: Windows only
VBA:
object.Eval Expression
Type: Application
The object this method applies to.
Access: Input-only
Type: String
The expression to be evaluated.
No return value.
This method allows Automation clients to execute a line of VBA code in the context of the current project without creating modules and functions.
VBA:
Sub Example_Eval()
' This example shows how to can use Eval to run a VBA code fragment
' without having to create a Module or procedure.
Dim VBACode As String
' Create VBA code fragment
VBACode = "MsgBox ""Simple code fragment"""
' Use Eval method to evaluate the small VBA script
Eval VBACode
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_Eval()
;; This example shows how to can use Eval to run a VBA code fragment
;; without having to create a Module or procedure.
(setq acadObj (vlax-get-acad-object))
;; Create VBA code fragment
(setq VBACode "MsgBox \"Simple code fragment\"")
;; Use Eval method to evaluate the small VBA script
(vla-Eval acadObj VBACode)
)