VBA の式を評価します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.Eval Expression
タイプ: Application
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: 文字列
評価する式。
戻り値はありません。
このメソッドにより、Automation クライアントはモジュールおよび関数を作成せずに現在のプロジェクトのコンテキストの中で VBA コードを 1 行実行することができます。
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)
)