VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UnloadDVB Execution error

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Jedimaster
603 Views, 3 Replies

UnloadDVB Execution error

I have a routine that I run to unload the  current VBA on exit. The routine works with no problem except it comes back with the “Execution error”. Evidently this has been a problem for some time since I was reading other posts. I know it is because it unloading itself before the end of the sub. If I use the send command VBAUnload it doesn’t  let the user restart the command by typing enter. It comes up with the VBAununload command.

 

Sub ExitOut()

      On Error Resume Next

      Set objNetwork = CreateObject("WScript.Network")

      Set colDrives = objNetwork.EnumNetworkDrives

      CurrentVBA = Application.VBE.ActiveVBProject.FileName

      For i = 0 To colDrives.Count - 1

           Drive = colDrives.Item(i)

           UNC = colDrives.Item(i + 1)

           CurrentVBA = Replace(CurrentVBA, UNC, Drive, 1, -1, 1)

      Next

      UnloadDVB CurrentVBA

End Sub

 

Thanks in advance for any help.

3 REPLIES 3
Message 2 of 4
arcticad
in reply to: Jedimaster

The short answer is don't do that. All that enter does is run the last command which was VBAUNload

---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 3 of 4
Jedimaster
in reply to: Jedimaster

Yes I am aware that exicutes the last comand. Send command  VBAUnload makes VBAUnload the last command.

UnloadDVB is transparent. The routine works fine with UnloadDVB it works fine just has that stupid error message at the end. The funny thing is if I run it through the VBAMAN it does not give me that error. It is only if the rounite is run from the command prompt that it kicks back the error.

Message 4 of 4
Jedimaster
in reply to: Jedimaster

Finally got rid of the exicution error. Not as pretty a little noisy but no error.

ThisDrawing.SendCommand "vbaunload" & vbCr & Chr(34) & Application.VBE.ActiveVBProject.FileName & Chr(34) & vbCr

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost