AutoCAD Electrical General Discussion

AutoCAD Electrical General Discussion

13 Posts
0 Kudos
Registered: ‎12-05-2012
Post 1 of 3

[VBA] Adding a drawing to a project folder

378 Views, 2 Replies
12-19-2012 02:54 AM



Is someone know the command to add the activate drawing to the project ?


My problem is that, I am generating various drawing and I would like to add them to a project, If someone know how to do that, It can help me.




Sub test2()

Dim AcadObj As AcadApplication
Dim AcadDoc As AcadDocument


On Error Resume Next
Set AcadObj = GetObject(, "AutoCAD.Application")
If Err.Number <> 0 Then
    Set AcadObj = CreateObject("AutoCAD.Application")
    NombreDessinAutocad = 2
End If
AcadObj.Visible = True

Set AcadDoc = AcadObj.Application.Documents.Add("C:\PATH\Cartouche_V1.0.dwt")

Set AcadUtil = AcadDoc.Utility
Set AcadEspaceObj = AcadDoc.ModelSpace
Set blockRefObj = AcadEspaceObj.InsertBlock(P, "C:\PATH\Mop_V1.1.dwg", 1#, 1#, 1#, 0)
document to the project


Set ...... **Looking for the command to add my drawing to the project**

End Sub





Valued Contributor
77 Posts
8 Kudos
Registered: ‎07-04-2007
Post 2 of 3

Re: [VBA] Adding a drawing to a project folder

12-20-2012 09:53 AM in reply to: Nicolas.L

I could not find any type of command to add a drawing to the project like you are looking for however you could just write some code to add the information to the project.wdp file. Its just a text file so its shouldn't be to difficult. You could also add some other info like Descriptions and Section or Subsection. Its in this format


===description 1
===description 2
===description 3


I use notepad to edit the ".wdp" file when I need to add lots of drawings with section and description information quickly.

You need to close the project before doing this and I always make backups of the file before changing things just in case! 

*Expert Elite*
1,053 Posts
150 Kudos
Registered: ‎09-21-2007
Post 3 of 3

Re: [VBA] Adding a drawing to a project folder

01-14-2013 10:50 PM in reply to: Nicolas.L

Hi Nico.


You should search for the VLAX-class that makes it easy for VBA to communicate with LISP, as the AcadE API is solely based on AutoLISP.

Then you should have a look in the help file.

Look for c:ace_add_dwg_to_project



Trond Hasse Lie

ECAD Consultant, CtrlAltEl

Please select "Accept As Solution" if this post answers your question. Kudos don't hurt either. ;-)
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions to get help installing your software.

New AutoCAD Electrical Category!

The AutoCAD Electrical forum has moved into it's very own category page, and can no longer be found within the Additional Product Forums.

Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.