How to open a drawing? newbie.

Discussion in 'AutoCAD' started by kb, Aug 8, 2003.

  1. kb

    kb Guest

    This maybe very basic, but I can't seem to do it, or find any reference to this. How can I open an existing drawing into ACAD with vba? (code example please, would be very helpful)

    Second, I have setup a macro that attaches a drawing, and runs a query report against that drawing. But I would like to apply a simple transformation to that drawing, but I'm not really sure how to go about it.
     
    kb, Aug 8, 2003
    #1
  2. ThisDrawing.Application.Documents.Open FileName
     
    Mark_Abercrombie, Aug 8, 2003
    #2
  3. kb

    kb Guest

    Ok, now how do I close the drawing I just opened?

    ThisDrawing.Application.Documents.Close ("D:\Acad\Drawings\test.dwg")



    Doesn't work
     
    kb, Aug 18, 2003
    #3
  4. kb

    Kevin Terry Guest

    Are you trying to close the drawing that ThisDrawing is referring to?



     



    If so, this should work (note change false to true if you want to save changes):



    ThisDrawing.Close False



     



    If not, then this should work:
    For i = 0 To Application.Documents.Count - 1
        If sNewFile = Application.Documents.item(i).FullName Then
            Application.Documents.item(i).Close False
        End If
    Next





    Kevin



    "kb" <-prairie.ab.ca> wrote in message news:...

    Ok, now how do I close the drawing I just opened?

    ThisDrawing.Application.Documents.Close ("D:\Acad\Drawings\test.dwg")



    Doesn't work
     
    Kevin Terry, Aug 18, 2003
    #4
  5. kb

    kb Guest

    That worked, thanks!!
     
    kb, Aug 18, 2003
    #5
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.