Jump to content

VBA on AutoCAD 2012 64 bit?


muck

Recommended Posts

I have recently upgraded form AutoCAD 2010 to AutoCAD 2012 (64 bit).

I am using the 64 bit AutoCAD enabler.

I notice that my VBA routines on this new will not run properly.

Text Field that I typed data into will not allow me to enter data.

Is there a fast solution to this problem that does not envolve recoding?

Thank you,

Link to comment
Share on other sites

In the short-term, have you installed the appropriate VBA Enabler for your version?

 

Thinking more long-term, consider porting your code to VB.NET - You'll need Visual Studio 2010 (I use Express), the appropriate ObjectARX SDK(s), and I recommend you also use the current Wizard for properly debugging (when using Express).

Link to comment
Share on other sites

Yes, what RenderMan said. I just read an article this morning about this very subject. After 2009, AutoDesk is no longer including the VBA Enabler deferring instead to the .NET world. They are unsure how long they will support this so I gave my client the heads up today that we might want to rethink our approach in doing all this VBA stuff. If in 24 months it's all gone away and the newer versions of AutoCAD only work with .NET...we are trying to think that far ahead.

Link to comment
Share on other sites

VBA will die through attrition - IMO. Microsoft is no longer supporting it (and hasn't for some time), and at some point Autodesk will stop providing the applicable enabler(s). But for now, it's available as a separate install. I believe the 2013 has a VBA enabler - oops - shhhh, still in Beta testing!

 

.NET is becoming the recommended development framework of Autodesk's choice. Many find LISP to be dominant in actual usage, but inadequate to handle many of the newer entity properties and methods (i.e., using vlax-dump-object on newer AECC* Objects). Thankfully, .NET provides a handy little Method by the name of LispFunction - This is how I am starting to make certain .NET functionality available from within LISP. :wink:

 

For example:

 

My GetOwner function uses System.IO.File Class from LISP.

Link to comment
Share on other sites

Its interesting we have a few VBA programs and rather than go .net I am looking at the ones we really use and convert them back to VL or plain lisp.

 

The question is where are the conversion tools ? the lisp to C++ was created years ago, wheres the autodesk lisp to .net ? I have 200+ to convert. Is Autodesk just intent on only having programers or developors write simple code in future. As a Autocad dealer in my past I spoke to lots of microstation people and said why aren't they using MDL and the answer was to hard, compared to simple lisp. As said before CorelCAD's macro record writes .net code ! Look at word and excell macros wrote VBA code what does current versions write I dont have a copy ?

 

Anyway I will get off my soapbox now.

Link to comment
Share on other sites

When I run the program with 2012 VBA (64bit) my text fields will not allow me to enter anything

into them. I try to change some text box properties but that did not work.

Any suggestions?

Thank you,

Link to comment
Share on other sites

Its interesting we have a few VBA programs and rather than go .net I am looking at the ones we really use and convert them back to VL or plain lisp.

 

Visual LISP is my primary development language; vlax-get-or-create-object is my/your friend. LoL

 

The question is where are the conversion tools ? the lisp to C++ was created years ago, wheres the autodesk lisp to .net ? I have 200+ to convert. Is Autodesk just intent on only having programers or developors write simple code in future.

 

LISP is much more elegant, and simpler to learn. The .NET API is constantly growing from version to version, and is considered a 'professional' development language, despite LISP's popularity with the masses.

 

In a thread I read the other day, Lee points out that LISP is +/-5 lines of code as compared to the same function in C# at 20+ lines of code.

 

That is why I am sticking to Visual LISP for the most part, and where there may be a short coming, I attempt to make .NET functionality available via LispFunction Method.

 

:beer:

Link to comment
Share on other sites

  • 2 weeks later...

It's a 64bit problem with VBA, Autodesk has no solution for VBA not running correctly in 64bit environment, in fact we tried a virtual 32bit os with Autocad in it, and it still had a problem. talk about killer for some of us that huge VBA scripts, and don't have the time to convert into dotnet! VBA will run in 64bit if the program is very simple, but make sure you have your code explicit. Also sometimes you may also overlook your references, make sure your still not referencing the 09 type library.

Our current crutch is a couple of older 32bit machines to run our larger code.

Link to comment
Share on other sites

This issue is creating a huge issue for an "old guy" like me...I bascially write VBA fast and easy - we actually use VBA on every project, every day...

Check this video out - debugging within the VBAIDE for 2012?

This jing Video shows the nature of debugging in the IDE vs running the VBA via Lisp... have fun figuring this one out - link to video - http://screencast.com/t/sfaQsj4Lo7XK

 

--JPL

 

my Lisp Code used to run the VBA is here:


;;;VBA Commands for Menus


;;;J.Lyons 2011


;;;load and run any VBA application found in the search path


(defun runmyvba (dvb macro)


 (setvar "cmdecho" 0)


 (setvar "filedia" 0)


 (if (findfile dvb)


   (progn


  (vl-vbaload (findfile dvb))


  (vl-vbarun macro)


   )


 )


 (setvar "filedia" 1)


 (princ)


)


(defun C:TESTBOX ()


 (runmyvba "YourVBAFilename.dvb" "YourVBAPublicModuleCommand")


 (princ)


)

Edited by JPL2012
Link to comment
Share on other sites

my Lisp Code used to run the VBA is here:

 

 

FWIW - Here's a simplified version:

 

(defun c:[color=blue]FOO [/color]( / path)
 (vl-load-com)
 (if (setq path (findfile "[color=blue]FileName[/color].dvb"))
   (vl-vbarun (strcat path "[b][color=red]![/color][/b][color=blue]ModuleName[/color][size=3][b][color=red].[/color][/b][/size][color=blue]Command[/color]"))
   (prompt "\n** File not found ** "))
 (princ))

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...