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

AutoCAD 2014 64bit - 20MB dvb File Crashes Randomly

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
lando7189
1391 Views, 6 Replies

AutoCAD 2014 64bit - 20MB dvb File Crashes Randomly

Processor Intel, Core i5-4570 @ 3.2GHz

8GB RAM

Windows 8, 64 bit

 

Hello all,  

 

  I just finished 'updating' my VBA code developed over the last 10 years from 'VBA 6' to 'VBA 7'.  When i view the code in the IDE of AutoCAD 2014, everything shows up fine -- no errors.  All of the references i need do exist:

 

Visual Basic for Applications

AutoCAD 2014 Type Library

Microsoft Forms 2.0 Object Library

Microsoft Scripting Runtime

OLE Automation

Microsoft Shell Controls and Automation

AutoCAD/ObjectDBX 19.0 Type Library

Microsoft ActiveX Data Objects 6.1           (or  2.7  or  2.8)

 

When i goto Debug-> Compile, it 'compiles' without errors.  But when i go to run it, it will crash.  If i put in a break point, and step through it, i can identify a subroutine that it crahses on.  But if i do it again and step INTO that sub, it runs fine.  If i have the code just continue on, it will crashe somewhere else.  Bascially for the most part, if i run a macro and have a breakpoint right away, i can put my stapler on the F8 key and just sit back and watch it run (although a 10 second process turns into about half an hour) -- it gets much further along but will still eventually crash.

 

I've never encountered anything like this before, and it is just so frustrating. I'm eager to find out if others have had this same issue or if anyone has a any recommendations or solutions.  Have a good day and thanks in advance!   

  

By the way, the same basic code runs fine on 32bit AutoCAD 2012 (with the appropriate references changes as well as no 'PtrSafe' or LongLong or LongPtr usages)

 

  - Lanny

6 REPLIES 6
Message 2 of 7
DavidTosh
in reply to: lando7189

Wow, nice machine. I am getting by on (32 bit) XP with AutoCAD 2014. I'm creating and editing VBA code every day with no new quirks.

 

You probably know as well as I, but it has always been considered good hygene to clean out the .dvb project file when things get weird. I do that by exporting to text and importing the text into a new, empty project. Have you tried this? That's my default every time I jump to a newer version (and it encourages me to leave some of the less-than-useful code behind.)

 

Otherwise, I'll watch from the sidelines 😉

 

---
Tosh
Message 3 of 7
lando7189
in reply to: lando7189

Thanks for the reply.  I actually never have tried that..lol...  I've got about 30 forms, 100+  modules and about 50 classes...  I'll give it a try.  Thanks.

Message 4 of 7
lando7189
in reply to: DavidTosh

I exported and imported all modules into a new project and established my references.  It crashes with a fatal error in pretty much the same fashion as before.  I guess it was worth a try.  - Lanny

Message 5 of 7
Balaji_Ram
in reply to: lando7189

Hi Lanny,

 

I haven't seen such reports of random crashes being reported earlier. 

 

Have you tried your project on a 32 bit environment and does it also crash ?

If it only crashes in 64 bit, can you isolate some portion of your code that frequently crashes and send me a dvb ?

 

BTW, your project seems really big and I would suggest migrating your code to use VB.Net as it is easier to debug and manage such large projects using .Net. In my opinion, this will be worth the effort as compared to migrating to a newer version of VBA.

 

A utility to migrate VBA code and DevTV recordings that explain VBA->VB.Net migration are available here :

 

DevTV: AutoCAD VBA to VB.NET Migration Basics

http://usa.autodesk.com/adsk/servlet/index?id=770215&siteID=123112

 

 

Regards,

Balaji

 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 6 of 7
lando7189
in reply to: Balaji_Ram

After much playing around, i finally found a solution.  When using using a 'custom' collections class (whether its a custom class using a collection or a variable that is a class), I found out that i have to add 'DoEvents' where ever the code uses an add or remove method.

Message 7 of 7
lando7189
in reply to: lando7189

Also, add 'DoEvents' before each 'For Each' loop... this can be done by doing a global replace of:

 

For Each

 

with

 

DoEvents : For Each

 

... i tested my code all of my commands work without crashing.  Happy Holidays!!!!  - Lanny

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

Post to forums  

Autodesk Design & Make Report

”Boost