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

VBA macros from AutoCAD 2008 to 2010 trouble

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
mmanning
1147 Views, 2 Replies

VBA macros from AutoCAD 2008 to 2010 trouble

I am afraid this is going to be an incredibly vague post, but let me give it a go anyway.

 

A co-worker wrote, or found and edited some code to create a custom toolbar to allow my associates to insert blocks (conveyor sections) into drawing, with part numbers. The code was originally from AutoCAD 2006, and was updated to work in 2008. Now we are updating to 2010 and some of the toolbar functions do not work. It still works properly on computers with 2008 but as soon as you upgrade and migrate to 2010 most of the features stop working

 

A function to export a part count to Excel still works, and a function to create a block works, but the functions that insert blocks from a reference no longer do. When you select the function you are prompted to chose an insertion point. As soon as you do, nothing happens.

 

Yes, I have installed the VBA enabler. I guess in the most general terms, other than needing to install the VBA enabler, has 2010 changed so dramatically that the macro should have 'broken'?

 

Almost forgot - AutoCAD 2010 32bit XP SP3.

 

Thanks in advance, and sorry about the obvious clueless nature of my post.

2 REPLIES 2
Message 2 of 3
laurie.comerford
in reply to: mmanning

Hi,

 

Why not open up the VBA Editor and set the code to break on all unhandled errors?  That will take you to the line where the error is occuring and you can think your way through it from there - or post a more detailed query here with the relevant code to allow others to recreate your error.

Regards

Laurie Comerford
Message 3 of 3
mmanning
in reply to: laurie.comerford

I tried that but actually couldn't get it to break. That's what was most confusing, there really wasn't anything resulting in a failure in VBA when debugging, the macro just wouldn't appear to complete the task. So I gave in and contacted my vendor and they got me in contact with a programmer at Rand. He took a look and found the problem was an entry in the code that was calling out the wrong AutoCAD version when the macro tried to pull in the dynamic block from the other drawing. Simply changing one character on several lines of the code fixed it.

 

It was this line

 

Set dbxDoc = AcadApplication.GetInterfaceObject("ObjectDBX.AxDbDocument.18")

 

It wouldn't work when the version was set to .16 in AutoCAD 2010. Version .16 works in 2006 thru 2008. .18 works in versions 2009 thru 2011.

 

 

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

Post to forums  

Autodesk Design & Make Report

”Boost