Getting Data from Excel to AutoCad

Discussion in 'AutoCAD' started by Norman Duke, Mar 30, 2005.

  1. Norman Duke

    Norman Duke Guest

    How do you connect to an open excel spreadsheet.

    Thanks in advance

    Norman Duke
     
    Norman Duke, Mar 30, 2005
    #1
  2. Hi Norman,

    Look in the sample files supplied with AutoCAD. There is code for an Excel
    Link supplied.

    --

    Regards,


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, Mar 30, 2005
    #2
  3. Norman Duke

    Norman Duke Guest

    Laurie. Thanks for your response. I have tried the samples but they only
    refer to an new workbook, and not an existing one.

    I have had the sample working. The real question I have is to access the
    current open excel workbooks activesheet. Once there I can get the data that
    I need.

    Norman Duke
     
    Norman Duke, Mar 30, 2005
    #3
  4. Norman,

    This will check for a running instance of Excel, if not
    it will create one. You'll find more in the Connectivity Group.

    gl
    Paul

    '<code>
    Sub excelTest()

    Dim oExcel As Excel.Application
    Dim wasRunning As Boolean

    wasRunning = IsExcelRunning

    If wasRunning Then
    Set oExcel = GetObject(, "Excel.Application.9")
    Else
    Set oExcel = CreateObject("Excel.Application.9")
    oExcel.Visible = True
    oExcel.UserControl = True
    End If

    'grab the active sheet, rip it up!

    'close it if you started it.
    If Not wasRunning Then
    oExcel.Quit
    End If

    End Sub

    Function IsExcelRunning() As Boolean
    Dim oExcel As Excel.Application
    On Error Resume Next
    Set oExcel = GetObject(, "Excel.Application.9")
    IsExcelRunning = (Err.Number = 0)
    Set oExcel = Nothing
    Err.Clear
    End Function
    '<code/>
     
    Paul Richardson, Mar 30, 2005
    #4
  5. Norman Duke

    Norman Duke Guest

    Thanks Paul
    That sent me in the correct direction.

    Norman Duke
     
    Norman Duke, Mar 30, 2005
    #5
  6. That sent me in the correct direction.
    That's a first..;-) Good Luck.
     
    Paul Richardson, Mar 30, 2005
    #6
  7. Norman Duke

    bcoward Guest

    bcoward, Apr 1, 2005
    #7
  8. Norman Duke

    Norman Duke Guest

    Bob

    Thanks for the additional information. There is a lot in there to keep me
    busy.

    Norman Duke
     
    Norman Duke, Apr 1, 2005
    #8
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.