Skip to content

Instantly share code, notes, and snippets.

@CADbloke
Created March 30, 2015 23:40
Show Gist options
  • Save CADbloke/b8b8632a954ee191f3d4 to your computer and use it in GitHub Desktop.
Save CADbloke/b8b8632a954ee191f3d4 to your computer and use it in GitHub Desktop.
Unloads VBA applications from AutoCAD 64-bit installations preversion 2014 so it can resume normal speed. See http://adndevblog.typepad.com/autocad/2012/05/64-bit-vba-performance-issue.html
(defun Get-VBA-Project-list (/ ACAD VBAO PRO N NAMES)
(vl-load-com)
(if (and
(setq ACAD (vlax-get-acad-object))
(setq VBAO (vla-get-vbe ACAD))
(setq PROs (vlax-get VBAO "VBProjects"))
) ;_ -and
(repeat (setq N (vla-get-count PROs))
(setq PRO (vla-item PROs N)
NAMES (cons
(list
(vlax-get PRO "Name")
(vlax-get PRO "FileName")
) ;_ -list
NAMES
) ;_ -cons
N (1- N)
) ;_ -setq
) ;_ -repeat
) ;_ -if
NAMES
) ;_ -defun
(defun C:UNVBA (/ app apps)
(setq apps (Get-VBA-Project-List))
(foreach app apps
(command "_VBAUNLOAD" (cadr app))
(princ (strcat (cadr app) " unloaded\n"))
(princ)
) ;_ -foreach
(princ)
(graphscr)
) ;_ -defun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment