(defun c:loadMyProject ()
;; This routine will load a project if it is not already loaded
;; the VBE (VB extensibility) ActiveX object is used to reference
;; the loaded projects
;; Load ActiveX
(vl-load-com)
;; Get the VBE extisibility object
(setq acadObject (vlax-get-acad-object))
(setq acadVbe (vla-get-vbe acadObject))
(setq acadVbeProjects (vlax-get-property acadVbe 'VBProjects))
;; Get the number of loaded VBA projects
(setq int1 (vlax-get-property acadVbeProjects 'count))
;; Counter and test variable named loaded
(setq int2 1)
(setq loaded "False")
;; Repeat for each project
(repeat int1
;; Itereate through the projects, getting the name of
;; next project, each time through
(setq Item (vlax-invoke-method acadVbeProjects 'Item int2))
(setq pName (vlax-get-property Item 'Name))
;; Test the name for the name of the project I want to load
;; If it is already loaded the set the test variable to True
(if (= pName "my_test_project")
(progn
(prompt "\nmy_test_project is already loaded\n")
(Setq Loaded "True")
)
)
;; Increment the number used to get the next Project
(setq int2 (+ int2 1))
)
;; Load project if it is not already loaded by testing
;; the Loaded variable
(if (= Loaded "False")
(progn
(princ "\nLoading my_test_project")
(command "-VBALOAD"
"D:/vba-apps/a-2000/already loaded test.dvb"
)
)