Accessing AutoCAD documents with Excel

Discussion in 'AutoCAD' started by e.barelds, Mar 16, 2005.

  1. e.barelds

    e.barelds Guest

    Hi,

    Is there someone who can tell me what i do wrong;

    I'm trying te acces AutoCAD with the following script;

    ----------------------------------------------
    Public objAcadApp As Object
    Public objAcadDoc As Object
    Public objMSpace As Object

    Function IS_ACAD_RUNNING()
    On Error Resume Next
    Set objAcadApp = GetObject(, "AutoCAD.Application")
    If Err Then
    MsgBox ("Cant load AutoCAD!" & Chr(13) & Chr(13) & Err.Description)
    Err.Clear
    End 'Stop the program!
    Else
    Set objAcadDoc = objAcadApp.ActiveDocument
    Set objMSpace = objAcadDoc.ModelSpace
    End If

    End Function
    ------------------------------------------------

    It does work on one computer, but not on the otherones. The message with I
    get is the object is not known?

    Grtz, Eddy
     
    e.barelds, Mar 16, 2005
    #1
  2. Well you code assumes AutoCAD is running, what if it isn't? So assuming
    AutoCAD is installed on all the computers, the If Err should be

    If Err.Number <> 0 Then
    Err.Clear
    Set objAcadApp = CreateObject("AutoCAD.Application.{version}")

    where {version} is the number of the release you are trying to access --->
    R16.0 =2004, R16.1 = 2005, etc.

    -- Mike
    ___________________________
    Mike Tuersley
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Mar 17, 2005
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.