Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to run autocad using exe file? 1

Status
Not open for further replies.

danijelSA

Structural
Nov 2, 2004
7
Hi!

I want to make group of macro commands, and all that
macro commands link with new (my) toolbar. Problem is:
How to make some exe file using VBA, which I can run from desktop, for lunching autocad.exe?

Thanks in advance!!!
 
Replies continue below

Recommended for you

You can't make an EXE with VBA, you need VB6 or VB.NET to do that.

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

UK steam enthusiasts:
 
What you need to do is create a VB application that a reference to the AutoCAD API, i don't have installed AutoCAD in this computer but go reference on VB and look for the AutoCAD API Object.

 
The code would look something like this:

Code:
    On Error Resume Next
    Set CadApp = GetObject(, "AutoCAD.Application")
    If Err.Number <> 0 Then     'Not Running
        Set CadApp = CreateObject("AutoCAD.Application")
        Err.Clear
        'AutoCAD may open a new drawing upon opening - close it
        CadApp.ActiveDocument.Close False
        If Err.Number <> 0 Then
            Err.Clear   'No Drawings are Open
        End If
    End If
    On Error GoTo 0

I used to use similar code to connect to AutoCAD 2000. As long as AutoCAD's object model hasn't changed significantly it should work for later versions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor