Author Topic: How to detect if VBA module is loaded?  (Read 2231 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7027
How to detect if VBA module is loaded?
« on: March 09, 2006, 11:01:49 AM »
How can I check (with lisp) if a VBA module is loaded in a drawing, and if it is, unload it?

I use vl-vbaload to load them but do not see an easy way to unload them?

Thanks,

Ron

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: How to detect if VBA module is loaded?
« Reply #1 on: March 09, 2006, 11:05:45 AM »
I unload after I use them.  Let find an example
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

ronjonp

  • Needs a day job
  • Posts: 7027
Re: How to detect if VBA module is loaded?
« Reply #2 on: March 09, 2006, 11:07:32 AM »
I unload after I use them.  Let find an example

I just found vla-unloaddvb. I think this will do the trick. I would still be interested to see how you unload after use.

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

Jürg Menzi

  • Swamp Rat
  • Posts: 597
  • Oberegg, Switzerland
Re: How to detect if VBA module is loaded?
« Reply #3 on: March 09, 2006, 11:10:54 AM »
Ron,
visit my homepage -> Free Stuff and search for 'VxGetLoadedVbaProjs'
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k14... A2k18 - Start R2.18

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: How to detect if VBA module is loaded?
« Reply #4 on: March 09, 2006, 11:11:10 AM »
Code: [Select]
  (defun c:TepDelPS ()
    (LOADER "pagesetup.dvb")
    (VL-VBARUN "pagesetup.dvb!Delpconfig")
    (command "vbaunload" "pagesetup.dvb")
  )
and the lisp to load
Code: [Select]
(defun loader (progname /)
  (vl-vbaload (findfile progname))
)
« Last Edit: March 09, 2006, 11:15:13 AM by CmdrDuh »
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

ronjonp

  • Needs a day job
  • Posts: 7027
Re: How to detect if VBA module is loaded?
« Reply #5 on: March 09, 2006, 11:34:52 AM »
Thanks for the reply guys.

CMDR..

You could prolly use this in your lisp so you wouldn't have to use the command:

Code: [Select]
(defun c:TepDelPS ()
  (LOADER "pagesetup.dvb")
  (VL-VBARUN "pagesetup.dvb!Delpconfig")
  (vla-unloaddvb
    (vlax-get-acad-object)
    (findfile "pagesetup.dvb")
  )
)

Ron

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: How to detect if VBA module is loaded?
« Reply #6 on: March 09, 2006, 11:48:55 AM »
cool, I will have to try that
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

Humbertogo

  • Guest
Re: How to detect if VBA module is loaded?
« Reply #7 on: March 09, 2006, 11:50:11 AM »
be carefully to unloading dvb according the ADN
ADN explained that he had intermittently experienced problems to unloading dvb files over the network.
I did try and have some crash to unloading dvb files over the network.

Jürg Menzi

  • Swamp Rat
  • Posts: 597
  • Oberegg, Switzerland
Re: How to detect if VBA module is loaded?
« Reply #8 on: March 09, 2006, 12:12:05 PM »
Code: [Select]
  (defun c:TepDelPS ()
    (LOADER "pagesetup.dvb")
    (VL-VBARUN "pagesetup.dvb!Delpconfig")
    (command "vbaunload" "pagesetup.dvb")
  )
and the lisp to load
Code: [Select]
(defun loader (progname /)
  (vl-vbaload (findfile progname))
)
Another remark:
If you are using vl-vbarun, you haven't to load the dvb. Vl-vbarun does this automatically...
(vl-vbarun (strcat (findfile "MyOwn.dvb") "!MyModule.MyMacro"))
Edited: missing parenthesis
« Last Edit: March 10, 2006, 01:49:45 AM by Jürg Menzi »
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k14... A2k18 - Start R2.18

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: How to detect if VBA module is loaded?
« Reply #9 on: March 09, 2006, 12:17:17 PM »
thats good to know!
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second