Yes, I never put code in a dwg. Run VBAMAN and you will see at the top of the dialog, the embedded project will be listed. Click on the Extract button and save it to a *.dvb file. Make sure that the folder you save it to is listed in the Options>File>Support File Search Path and Options>Files>Trusted Folders.
Now you just need to load the dvb when you want to use the commands you created. For me, the best way is to create a cuix with the toolbars or ribbon commands you will use. Then create a *.mnl file with the same name as your cuix. The mnl contains lisp. You can use the following lisp to load your dvb when the menu loads.
;;; Ed's toolbox
;;; support functions for EngineeringUtilities.cuix routines
;;;________________________________________
(setq supdir "c:\\AcadCustom\\support_GS\\")
;;; *********************
;;; setq global variables
;;; *********************
(vl-load-com)
;;; get the application object
(setq *acadObj* (vlax-get-acad-object))
;;; *********************
;;; load vba modules used by engr.mnu
;;; *********************
(vl-vbaload (strcat supdir "Toolbox.dvb"))
;; array of command name strings your dvb has.
;; i.e. the names of all the Public Sub methods.
(setq CommandList
(list
"EraseClouds"
"PrintSchedule"
"SaveAll"
"SetViewportScale"
)
)
;; make a defun for each command name
;; commands that will run in the document context
;; This way you can run a command without the VBARUN command.
;; It makes it easy to repeat the last command too, [Enter].
(foreach CommandName CommandList
(eval
(list 'defun
(read (strcat "C:" CommandName))
'()
(list 'vla-RunMacro *AcadObj* CommandName)
'(princ)
)
)
)
;;; *********************
;;; end loading engr.mnl
;;; *********************
(princ "\nEngineering Utilities Menu loaded")
Save the above lisp as yourcuixname.mnl. Change the path and filenames to match your setup. For further discussion, look here.
Ed
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to
post your code.