Hi Guys,
I am currently working on a project where I am taking a lot of Autocad Attributes and Eporting them to an excel file so they can be referenced in a table of contents type of manner. My question is if there is a way to have excel automatically update the tables after changes are made to the autocad file. This file is an ever changing thing so going back and running through the entire "Eattext" commad and re exporting and overwriting the existing file is very tiresome, especially when I am adding and deleting attributes daily. Is there a VBA program I can run to accomplish this task, I have failry limited VBA skills and haven't written in VBA for years. I am fairly new to exporting autocad attributes to excel so if there is a very simple fix that I do not know about please forgive my ignorance.
I attached a very simplistic example of the general Idea of what I am trying to accomplish.
Any help would be greatly appreciated
Thanks
There may be existing VBA program/code that does what you want or similar to what you want. But most likely, you need to write your own code to do exactly you want.
However, the important thing of your requirement is not to how to write VBA code (or .NET API code, which is a bit more furture-proof in term of AutoCAD programming), rather, it is how you decide the process workflow and how the workflow fit your situation the best.
You can do batch processing a bunch of drawings to extract attribute data to external data sotrage (be it Excel file or other type of file/database), automatically at certain time of the day, or run it manually whenver it is needed; This way, you can guaranttee the data in data storage is up-to-date at the moment of last batch processing completion. Also, AutoCAD user is not bothered to do any extra work to make sure data is updated to external data store.
You can right code (and loaded into AutoCAD whet it starts) to watch certain events iin AutoCAD. Say, you can handle AcadDocument.BeginDocClose/AcadApplication.BeginQuit event and extract attribute data and save it when this event happens. That is, user is free to do anything withthe drawing, and when the drawing is to be closed, you code examine the drawing and decide if there is attribute data to be extracted and saved. You can also watch AcadDocument.ObjectAdded/ObjectErase/ObjectUpdated event to do the similar thing.
You may want to make sure you code that extracts attribute and code that save data to external data store is well separated so you have flexibility later to save data to different external data store without break your code that extract attribute data.
Look at this
https://www.youtube.com/watch?v=oGyCLcY7-HE
It's a video's which explains my work. Basically you can import properties of line polylines and text to excel and whenever you modify something in drawings automatically excel spreadsheet will be update. You can list properties of different drawings togheter also.
Let me know if this macro matches you request.
Vittorio
Thanks for your guidance gizmowiebe, but unfortunately both those links doesn't work :(.
http://www.visiblevisual.com/jupgrade/index.php/autocad-vb-vba/66-export-blocks-to-excel
http://www.visiblevisual.com/jupgrade/index.php/general-net/135-get-block-attributes-net
I want to use excel VBA to extract the data .dwg file, all the components in diagram to be exported to excel.
I would like to have a VBA code to do that.
Thanks
Senthil