Oh, i guess that's because of the pasting.
It's two lines in my code.
btw, i found this
Sub Main()
Dim ACAD As AcadApplication 'Create ACAD variable of type Acad Application
On Error Resume Next 'This tells VBA to ignore errors
Set ACAD = GetObject(, "AutoCAD.Application") 'Get a running instance of the class AutoCAD.Application
On Error GoTo 0 'This tells VBA to go back to NOT ignoring errors
If ACAD Is Nothing Then 'Check to see if the above worked
Set ACAD = New AcadApplication 'Set the ACAD variable to equal a new instance of AutoCAD
ACAD.Visible = True 'Once loaded, set AutoCAD® to be visible
End If
ACAD.ActiveDocument.Utility.Prompt "Hello from Excel!" 'Print a message to the AutoCAD® command line
End Sub
and using the code to open the cad.
and by activating the autocad library in the vba, It's not crashing anymore now
Thanks