AutoCAD Electrical General Discussion

AutoCAD Electrical General Discussion

Reply
Contributor
Nicolas.L
Posts: 13
Registered: ‎12-05-2012
Message 1 of 4 (374 Views)

[VBA] Create a folder and a project

374 Views, 3 Replies
12-11-2012 12:15 AM

Hello,

 

I found how to open autocad and how add drawing by looking on forums and the help section au AtucadElectrical but there is a thing that i can't find:

 

How to create a folder, a projet and add (new drawing to that folder)

 

Regards

 

Nicolas

 

This is the beginning of the code:

 

Sub Initialise()
    Dim NewDrawing1 As AcadDocument
    Dim Newdrawing2 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.ActiveDocument
        Set AcadUtil = AcadDoc.Utility
        Set AcadEspaceObj = AcadDoc.ModelSpace
        Set NewDrawing1 = AutoCAD.Application.Documents.Add("")
        Set Newdrawing2 = AutoCAD.Application.Documents.Add("")
       
        Dim drawing As AcadDocument
        For Each drawing In AutoCAD.Application.Documents
            drawing.Activate
            MsgBox "Drawing " & drawing.Name & " is active."
        Next drawing
 
    Excel.Application.Visible = True
 
End Sub

Mentor
johnq
Posts: 219
Registered: ‎05-24-2011
Message 2 of 4 (351 Views)

Re: [VBA] Create a folder and a project

12-12-2012 01:56 PM in reply to: Nicolas.L

Hi Nicolas

 

Your question has a lot to it.

 

While I could show you, it is too long winded to answer here.  I know that is not what you need to know.

 

I do not sell training so when I suggest you should get some training then it it true.

 

Now to help with limited 18 months experience:

 

I could not create a project for scratch.   I needed to open a project from the built in Tutorials in ACE.  Open a drawing from that project.

 

That project needed to be Active.   It is bold high lighted.

 

Then I could go through the process of creating a project.

 

If I had a choice I would have a seperate Letter drive for ACE even if you only had one physical drive.

 

Also go to www.ecadconsultant .com  There is some good info but I must be thick as some of it I found criptic but eventually I got the message.

 

Cheers  John QUigley

 

 

 

 

 

 

Mentor
johnq
Posts: 219
Registered: ‎05-24-2011
Message 3 of 4 (348 Views)

Re: [VBA] Create a folder and a project

12-12-2012 02:44 PM in reply to: johnq

Hi Nicolas

 

I should have tried to find out what VBA was before I tried to help.  I have just made a fool of my self as I think you are using Vault etc.

 

Forgive me for I know what what i do.

 

All the best forthe new year.

 

Cheers  jq

Contributor
Nicolas.L
Posts: 13
Registered: ‎12-05-2012
Message 4 of 4 (342 Views)

Re: [VBA] Create a folder and a project

12-12-2012 10:43 PM in reply to: johnq

Hi John,

 

First of all thanks to take time on my problem.

 

I use VBA, maybe it's also call VB, anyway it is a .NET language. I stopped using this language and I goes on a maybe more structural oriented programming language which is C#.

 

I don't really understood all the things of your answer but I understood that it is not as easy as I thought.

 

Thanks for your answer,

 

Have an Happy new year

 

Nicolas

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.

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