Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VBA - List of objects in a drawing

VBA - List of objects in a drawing

VBA - List of objects in a drawing


I have a huge file with numerous objects I need to work on.
I need to identify various bodies that I cannot see in the GUI. The screen is very busy and I need to extract some objects and delete unnecessary ones, but it is too risky to do it with the GUI. I would like to do it with a script so I can have 100% control on what I am doing.

I would like to have the list of all objects and as much information I can get (layer, bounding box, object type etc.)

I would like to generate this list in VBA.

Any ideas?

Thank you
Replies continue below

Recommended for you

RE: VBA - List of objects in a drawing


I now nothing about the AutoCAD Application Object Model.

But I do know how object models work.

An object model I’m familiar with and I’d bet you might have some familiarity with is the Excel Object Model.
So you need to know the AutoCAD Application Object Model very well.

So using our commonly understood object model, what if I wanted to know all the Chart Objects I had in all open workbooks...


   Dim wb As Workbook, ws As Worksheet, co As ChartObject, ch As Chart

   For Each wb In Excel.Workbooks
      For Each ws In wb.Worksheets
         Select Case ws.Type
            Case xlWorksheet
               For Each co In ws.co
                  Debug.Print co.Name, ws.Name, wb.Name
            Case xlChart
               Debug.Print ws.Chart.Name, ws.Name, wb.Name
         End Select

So you would need to do something like this for each object of interest.


glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close