VBAIDE 拡張オブジェクトを取得します。
サポートされているプラットフォーム: Windows のみ
読み込み専用: はい
タイプ: Microsoft VBE オブジェクト
VBAIDE 拡張オブジェクト
このプロパティを使用すると、AutoCAD のオブジェクト モデルから VBA IDE オブジェクト モデルにアクセスできます。VBAIDE が使用可能ではない場合、このプロパティは例外を発生させます。たとえば、acvba.arx アプリケーションがロードされていない場合、VBAIDE は使用できません。
次の行のコードは、アクティブな VBA プロジェクトの説明文字列の名前を戻します。
ThisDrawing.Application.VBE.ActiveVBProject.Description
VBA:
Sub Example_VBE() ' This example uses the VBA IDE extensibility model to dynamically ' create a VBA subroutine. After running this example, see the first line of code ' in the VBA IDE code window to see a new subroutine. Then ' remove the new subroutine before continuing. Dim VBEModel As Object Dim newRoutine As String Set VBEModel = VBE ' Get the VBE object ' Define new subroutine to be added. This could be created dynamically from user feedback. newRoutine = "Sub Dynamic_Procedure()" & vbCrLf newRoutine = newRoutine & vbTab & "MsgBox ""New subroutine.""" & vbCrLf newRoutine = newRoutine & "End Sub" & vbCrLf ' Insert new subroutine VBEModel.CodePanes(1).CodeModule.InsertLines 1, newRoutine MsgBox "A new subroutine was added called Dynamic_Procedure." End Sub
Visual LISP:
(vl-load-com) (defun c:Example_VBE() ;; This example uses the VBA IDE extensibility model to dynamically ;; create a VBA subroutine. After running this example, see the first line of code ;; in the VBA IDE code window to see a new subroutine. Then ;; remove the new subroutine before continuing. ;; Note: You might need to add a code module to the default project first. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq VBEModel (vla-get-VBE acadObj)) ;; Get the VBE object ;; Define new subroutine to be added. This could be created dynamically from user feedback. (setq newRoutine (strcat "Sub Dynamic_Procedure()" "\n MsgBox \"New subroutine.\"" "\nEnd Sub")) ;; Insert new subroutine (vlax-invoke-method (vlax-get-property (vlax-invoke-method (vlax-get-property VBEModel 'CodePanes) 'Item 1) 'CodeModule) 'InsertLines 1 newRoutine) (alert "A new subroutine was added called Dynamic_Procedure.") )