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 2013 and VBA

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
uumu2124
5918 Views, 3 Replies

AutoCAD 2013 and VBA

Hello All,

 

 I'm facing problems in using AutoCAD 2013 with code written in vba 6 many years back. While I'm able to run the program, the users face problems (unpredictable) like - slower operations, sometimes difficulty in entering data in forms-textboxes, block-attribute not getting read sometimes, utility (getpoint etc.) not working at times etc.  This program runs very smoothly on WinXP, AutoCAD 2010 and MS-Access 2010 (via adodb connection) - all are 32-bit.

 

Now I'm trying to migrate to AutoCAD 2013 (64-bit) on Win 7 (64-bit), the Ms Access being 2010 (32-bit). From my study of forums and other websites / autocad help etc., I gather that all my problems are due to vba 6 being 32-bit and asynchronous process with AutoCAD 2013 (64-bit) process.  I guess I've following options (all considering Windows 7 64-bit only):

i) Stick with AutoCAD 2013 64-bit and try fixing vba 6 code ......This I've done to the extent possible but errors are unpredictable as mentioned above, hence not a solution.

ii) Use AutoCAD 2013 32-bit........I think this is not possible as OS is 64-bit. Even if it's possible, then the VBA will still be asynchronous and may cause handshake / interface problems with autocad.

iii) Upgrade to AutoCAD 2014 64-bit with VBA 7 64-bit.........This seems good, but then I face problems in connection with 32-bit MS Access ! Looks like I will have to up[grade Ms Access to 64-bit aswell OR use ODBC 64-bit to connect to 32-bit MS Access. Either way, the DB connection is very toublesome.

iv) Upgrade to AutoCAD 2014 32-bit with vba7 32-bit..............I think this is not possible as OS is 64-bit.

v) Stick to AutoCAD 2013 64-bit, and migrate vba code to VB.Net........Lot of work , but probably good solution. Haven't tried yet.

 

The program is (though certified) in production and causes problems intermittently (but we have to debug and solve OR end task etc) and I need urgent solution.

 

Appreciate solution from anyone.

 

Thanks a ton in advance - Parag Agarkar

3 REPLIES 3
Message 2 of 4
norman.yuan
in reply to: uumu2124

You have 2 options, if you have to stick with VBA, AFAIK:

 

1. Using 32-bit AutoCAD with 64-bit Windows OS. Yes, there is way to install 32-bit AutoCAD with 64-bit Windows (see www.longbowsoftware.com, but I do not know if it violates AutoCAD lisence or not).

 

This way, you can use all latest version of AutoCAD (2013/14/15) with in-process 32-bit VBA. All your existing code should work without the problems derived from 64-bit AutoCAD and 32-bit out-process VBA.

 

However, in this case, AutoCAD can only command not more than 4GB memory, even the Windows has more memory installed, this may not be a big deal.

 

2. You can use 64-bit AutoCAD with 64-bit in-process VBA (2014 or later).

 

If the data access to *.mdb/*.accdb is via ADO, you need to install MS Access Database Engine 64-bit. If the CAD computer does not have MS office installed, this is not an issue. If the CAD computer needs to have 32-bit MS Office, it must be MS Office 2010 or 2013 (including MS Access or not), and the 64-bit DB engine's install is a bit tricky. If the 32-bit MS Office installed is Office 2007, then the 64-bit DB Engine cannot be installed. So, the data access is likely not a big issue here.

 

If the VBA apps have rich UIs, you might have bigger issue: there is almost no 64-bit controls comparable to 32-bit version available. Even as simple as Open/Save File Dialog, you need to write complicated Win32 API code, which most VBA coders have no idea how to do it.

 

IMO, if the VBA apps are very mission-critical, you might be looking at migrating to .NET sooner than later. Also seriously consider migrate data from Access DB to a server-nased database.

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 4
uumu2124
in reply to: norman.yuan

Hi Norman,

Thanks and I agree with you.  I prefer option 2 i.e. AutoCAD 2014 with VBA 7.1 64-bit and SQLServer DB (Express edition). I guess I've to install 64-bit (and not 32-bit) of SQLServer , right ?

I'm not sure about success of my form controls in migration from VBA 6 to VBA 7 64-bit, but I'll try.

 

In case I face problems with this mode, I'll try the option 1.

 

Thanks again, Parag

Message 4 of 4
norman.yuan
in reply to: uumu2124

You can install SQL Server Exporess on your computer (for developing/testing) or any computer on the next work of your office (so that all CAD users in your office can access to it). If the computer is 64-bit OS, the SQL Server will also be 64-bit, but this is iirelevant to AutoCAD being 32 or 64-bit, because your VBA's ADO data access code would use MS OLE DB Provider for SqlServer (or for ODBC, if you have to choose for certain reason), which comes with the Windows OS.

 

Before you decide to use AutoCAD 2014/15' 64-bit VBA, you'd better just try to load your existing DVB files into acad2014's 64 bit VBA IDE and do a compiling to sfind out how many 32-bit components that break the VBA projects in 64-bit environment. and have to be replaced. Then you need to find and identify 64-bit equivalents (very rare) and workaround (meaning changing code and workflow logic). Again, deepending oour existing VBA projects, it often turns out that moving into VBA 64-bit is not much easier than moving to .NET API, or going back to LISP.

Norman Yuan

Drive CAD With Code

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost