Author Topic: Unloading a VBA Project  (Read 5484 times)

0 Members and 1 Guest are viewing this topic.

ML

  • Guest
Unloading a VBA Project
« on: January 25, 2008, 04:11:14 PM »

I have a simple question:

After unloading a project (dvb) has anyone ever gotten the command line erroe
Execution error?

If so, does anyone know how to clear the error?

I would rather not see that error at the command line; doesn't look good :)

Thanks!
Mark

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Unloading a VBA Project
« Reply #1 on: January 25, 2008, 04:14:28 PM »
post how your unloading, maybe
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.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Unloading a VBA Project
« Reply #2 on: January 25, 2008, 04:15:08 PM »
if your unloading from within the sub, your essentially crashing out of vba to unload
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.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

ML

  • Guest
Re: Unloading a VBA Project
« Reply #3 on: January 25, 2008, 04:21:19 PM »

Well

At the end of the sub,
I put
Code: [Select]
Application.UnloadDVB "K:\Full\Path\Projectname.dvb"

I tried addressing the error like this:
Code: [Select]
Application.UnloadDVB "K:\Full\Path\Projectname.dvb"

If Err.Description = "Execution error" Then
  Err.Clear
End If

End Sub
but I'm still getting the error

ML

  • Guest
Re: Unloading a VBA Project
« Reply #4 on: January 25, 2008, 04:25:30 PM »

Yes

I realize that.
It is attempting to unload prior to reaching the end of the sub.
That is pretty silly.
Why would they have a method that does that?

Still if you put it right before the End Sub, all of the code executes just fine; I just don't want that error to appear on the command line.
That is why I am at least attempting to clear it.

We need an After Sub Executes event shewwww, it never ends

Mark

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Unloading a VBA Project
« Reply #5 on: January 25, 2008, 04:27:23 PM »
I handle it by haveing a short LSP that loads, calls, and unloads the DVB
Code: [Select]
  (defun c:TepPSc ()
    (LOADER "pagesetup.dvb")
    (VL-VBARUN "pagesetup.dvb!PSTepCSize")
    (command "vbaunload" "pagesetup.dvb")
  )
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.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Unloading a VBA Project
« Reply #6 on: January 25, 2008, 04:27:46 PM »
Loader is a function to check to see if the DVB is already loaded
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.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Unloading a VBA Project
« Reply #7 on: January 25, 2008, 04:28:40 PM »

Well

At the end of the sub,
I put
Code: [Select]
Application.UnloadDVB "K:\Full\Path\Projectname.dvb"

I tried addressing the error like this:
Code: [Select]
Application.UnloadDVB "K:\Full\Path\Projectname.dvb"

If Err.Description = "Execution error" Then
  Err.Clear
End If

End Sub
but I'm still getting the error

thats because the eror handler never gets to run b/c you have unloaded it
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.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Guest

  • Guest
Re: Unloading a VBA Project
« Reply #8 on: January 25, 2008, 04:31:14 PM »
I don't unload my DVBs.  They used to reside on our network, but now each user has a copy on his/her computer.  Any time I make a change, the updated file is copied from the master location on the network and overwrites the one on the user's PC.  This way I can make changes to files and not have to worry about user's having a file open on the network, in which case, I wouldn't be able to make the change.

My two cents.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Unloading a VBA Project
« Reply #9 on: January 25, 2008, 04:38:10 PM »
ditto that, I have a batch routine that copies down the latest code each time they reboot
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.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

ML

  • Guest
Re: Unloading a VBA Project
« Reply #10 on: January 25, 2008, 04:55:11 PM »

Sorry Guys
But I don't want to get into that
No offense, but to me that is a major pain in the a*s
Every time you make a minute change you have run a batch or a script to copy it to each user? sheww

There is no problem sharing a project but it MUST be unloaded after it is ran; that's all.

Usually I address it in the menu macro
Very simply:
After ^c^c-vbarun;etc. etc.^c^cvbaunload;PathandProject.dvb;

However, this module prompts the user to pick points and the vbaunload (in the menu macro) is not jiving well with that

CM,
In the menu macro, I have even used LISP (command "vbaunload" "projectname.dvb") but that isn't jiving well either

I appreciate the suggestion but
I don't want to run a LISP routine just to unload a dvb project.

Yes, you are totally right; unload is coming before the errorhandler too
I don't think we can say; on error err.clear?

Thanks guys!
Mark

ML

  • Guest
Re: Unloading a VBA Project
« Reply #11 on: January 25, 2008, 04:59:30 PM »

Now

If you are sharing .pc3 files, that is a great idea
Tell the user that every night the pc3 files are getting overwritten so, do something with it if you don't want it overwritten.

See, in this case other people would be against sharing .pc3 files; I just prefer to share every possible thing, it makes management of everything a bit easier. Of course there are things that are inherently not able to be shared, but share what we can.

We even have a .pc3 file called custom.pc3 so that the set .pc3 files are not tampered with
Do you think people use it?
Of course not LOL
Well, a few :)

Hence the script

Mark

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Unloading a VBA Project
« Reply #12 on: January 25, 2008, 05:02:05 PM »
I use the lisp routine so that menu macros can call it, my typers can call it, etc
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.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Guest

  • Guest
Re: Unloading a VBA Project
« Reply #13 on: January 28, 2008, 08:16:25 AM »

Sorry Guys
But I don't want to get into that
No offense, but to me that is a major pain in the a*s
Every time you make a minute change you have run a batch or a script to copy it to each user? sheww

In my custom ACAD.lsp file (which is on the network and is run on every CADD station whenever a drawing is opened) I have a program that reads two files - one on the network and one on each user's HD - if ANYTHING is different in either of those files, files from the network are copied to the user's HD and those become the "latest and greatest" files.  The files that are being compared are INI-type files, so whenever I make a change to, let's say a DVB, I change the number in the DVBS section and *poof!*  The next time a user so much as even opens a drawing, the latest files are copied from the network to the HD WITHOUT the user even knowing!!  If you want, I can post some of the code so you can get a better idea of what's really going on.


Quote
[MENU]
VERSION=84
[SLIDE]
VERSION=16
[ACAD]
VERSION=33
[SDSKDFM]
VERSION=2
[DVBS]
VERSION=36

[DETAILS]
VERSION=14

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Unloading a VBA Project
« Reply #14 on: January 28, 2008, 09:05:43 AM »
i would be interested in seeing your comparison logic, or does it just use literal string comparison?
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.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)