Results 1 to 10 of 10

Thread: open acad drawings within excel VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,168
    Location
    Hi gary lee,

    Welcome to VBAX

    When posting code use the vba tags it will display the code as if it was in the vbaide


    Dim AcadApp as Acadapplication
    Dim MyDwg as AcadDocument
    Dim DWG as string ' file path
    Set AcadApp = GetObject(, "AutoCAD.Application")
    Set MyDwg = AcadApp.Documents.Open(DWG) '<- the DWG should contain "C:\acad\somedrawing.dwg"

    The way I use it


    Public Graphics As AcadApplication
    Public Sub OpnAcad()
    Dim AngBracDwg As String
    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)
    End Sub


    Let me know if more assistance is needed.
    Last edited by Aussiebear; 04-09-2023 at 04:40 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
  •