Results 1 to 10 of 10

Thread: open acad drawings within excel VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,168
    Location
    If you don't have a reference checked in the tools > reference > AutoCad xxxx type library it will have errors, the getobject function will not work. I am sorry I forgot to tell you that.

    Public Graphics As AcadApplication 
    Public Sub OpnAcad() 
    Dim AngBracDwg As String 
    On Error Resume Next 'I added this line
    Set Graphics = GetObject(, "AutoCAD.Application") 
    If Err.Description > vbNullString Then 
       Err.Clear 
       Set Graphics = CreateObject("AutoCAD.Application") 
    End If 
    AngBracDwg = "c:\dwg\ba1.dwg" 
    Graphics.Documents.Open (AngBracDwg) 
    On Error goto 0
    End Sub
    Last edited by Aussiebear; 04-09-2023 at 04:41 AM. Reason: Adjusted the code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •