计算 VBA 中的表达式。 支持的平台:仅窗口 返回值(RetVal)无返回值。 言论此方法允许自动化客户端在当前项目的上下文中执行一行 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)
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 08:43
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.