马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
 - (defun Load_And_Run_VBA (File Procedure / cFile)
- (vl-load-com)
- (defun Get_VBP_List (/ cPr cPat VBPrj pQnt pCnt prLst)
- (setq VBPrj (vlax-get
- (vla-get-VBE
- (vlax-get-acad-object)
- )
- 'VBProjects
- )
- pQnt (vla-get-Count VBPrj)
- pCnt 1
- )
- (repeat pQnt
- (setq cPr (vla-Item VBPrj pCnt))
- (if (vl-catch-all-error-p
- (setq cPat (vl-catch-all-apply
- 'vlax-get
- (list cPr 'FileName)
- )
- )
- )
- (setq prLst (cons "*Invalid Project*" prLst))
- (setq prLst (cons cPat prLst))
- ) ;_ end if
- (setq pCnt (1+ pCnt))
- ) ;_ end repeat
- prLst
- ) ;_ end of Get_VBP_List
- (if (setq cFile (findfile File))
- (progn
- (if (not (member (strcase cFile)
- (mapcar 'strcase (Get_VBP_List))
- )
- )
- (vl-vbaload cFile)
- ) ;_ end if
- (if (member (strcase cFile)
- (mapcar 'strcase (Get_VBP_List))
- )
- (vl-vbarun Procedure)
- (princ
- (strcat "\n<!> Can't to load VBA Project: '"
- cFile
- "' <!> "
- )
- )
- ) ;_end if
- ) ;_end progn
- (princ
- (strcat "\n<!> Can't to find VBA Project: '"
- File
- "' <!> "
- )
- )
- ) ;_ end if
- (princ)
- ) ;_ end of Load_And_Run_VBA
|