Code Red > VB(A)

Both way link between Excel and AutoCad

(1/6) > >>

VELI555:
Hi everybody.

I am new member here and I have tried to find answer to my problem. I am a student and I am working on my thesis right now. I have a problem here. How can I make a both way link between Excel and AutoCad. By that I mean if I move a block in AutoCad drawing it would be great if the Excel could update the new coordinates to Excel worksheet. And other way around if I change the blocks coordinates in Excel it would move the block in AutoCad drawing. I have red that this can be done by VBA but I don't know how?  Could you help me with this? Thank you already. ( I apologize possible mistakes in spelling)

Best Regards
Veli

ChuckHardin:
You would need 2 VBA apps:
1. From AutoCAD open and update Excel or a direct update of a csv file.
2. From Excel open and update Autocad or use Open Design software.

If it is just block refs this should be fairly easy if the block name is unique or you save the object handle in excel. WARNING: If a drawing has to be recovered the handle could change or the block name could change!!

This is why my blocks have a Record Number Attribute that is unique for each block insertion.

Hope this helps in getting you started.

VELI555:
Hi Chuck

So you give every block a different number in to the attribute data. And you use this number to recognize each block. Right? What do you mean by using two different VBA apps?

M@yhem:

--- Quote from: VELI555 on January 25, 2012, 07:20:11 am ---Hi Chuck

So you give every block a different number in to the attribute data. And you use this number to recognize each block. Right? What do you mean by using two different VBA apps?

--- End quote ---
Every object in AutoCAD has a unique ID number - a "handle".  You would use this to update the spreadsheet.

You don't need two apps.  I think he was pointing out that it could be done from AutoCAD to Excel or vice versa.  The code to do it from Excel to AutoCAD might be a bit longer, but not by much.


I might have an old sample app kicking around somewhere.  If I find it, I'll post it.

VELI555:
Ok thanks for the info, but isn't the "handle" only greated when you export block information to somewhere? And if you send that info again the AutoCad will greate a new handle even though it was the same block? A sample app would be wery great thank you.

Navigation

[0] Message Index

[#] Next page

Go to full version