I thought it was working, and it did. Except I get a memory leak somewhere. After every drawing my memory keeps increasing, and doesn't decrease. and after 10 drawings my memory is 2 GB and autocad crashes. What might be the problem? this is my current code
Sub Example_Import()
Dim MyXL As Object ' Variable to hold reference
Dim MyXLSheet As Object
Dim r As Range
Dim n As Integer
Dim Acad As AcadApplication
Dim newdoc As AcadDocument
On Error Resume Next
'Opening Excel Sheet with drawings
Set MyXL = GetObject(, "Excel.Application")
Set MyXL = GetObject("C:\Probleem Tekeningen\macro_dwg_to_dwg.xls")
MyXL.Application.Visible = True
MyXL.Parent.Windows(1).Visible = True
Set MyXLSheet = MyXL.ActiveSheet
'Pasting cells A & B Together
Set r = MyXLSheet.Range("C1:C74")
For n = 1 To r.Rows.Count
r.Cells(n, 1) = "=CONCATENATE(RC[-1],RC[-2])"
'Opening Drawing
ThisDrawing.Application.Documents.Open (r.Cells(n, 1))
ThisDrawing.Application.ZoomAll
ThisDrawing.SendCommand "_ai_selall "
ThisDrawing.SendCommand "_copyclip "
ThisDrawing.Close
Set Acad = ThisDrawing.Application
Set newdoc = Acad.Documents.Add("acad.dwt")
ThisDrawing.SendCommand "_pasteclip Specify insertion point: 0,0 "
ThisDrawing.Application.ZoomAll
'Name = r.Cells(n, 1)
ThisDrawing.SaveAs (r.Cells(n, 1))
ThisDrawing.Close
Next n
End Sub