Hi Sam, i think i know what causes the crash.
I use this code to link excel with autocad
'allows access to autocadPublic acadApp As Object
Public acaddoc As Object
Sub open_Cad()
Dim warning As Integer
'ENSURES USER KNOWS OPEN DRAWING WILL BE EDITED, YES NO TO PROCEED
warning = MsgBox("Coordinates will be saved into currently opened drawing." & vbCrLf & "If no drawing is open, a blank drawing will be opened." & vbCrLf & "Would you like to continue?", vbYesNo, "Data Loss Warning")
Select Case warning
'if they select yes to proceed
Case 6
On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.Application")
'If AutoCAD is not opened create a new instance and make it visible.
If acadApp Is Nothing Then
Set acadApp = CreateObject("AutoCAD.Application")
acadApp.Visible = True
End If
'Check (again) if there is an AutoCAD object.
If acadApp Is Nothing Then
MsgBox "Sorry, it was impossible to start AutoCAD!", vbCritical, "AutoCAD Error"
Exit Sub
End If
On Error GoTo 0
'If there is no active drawing create a new one.
On Error Resume Next
Set acaddoc = acadApp.ActiveDocument
If acaddoc Is Nothing Then
Set acaddoc = acadApp.Documents.Add
End If
On Error GoTo 0
'Check if the active space is paper space and change it to model space if so
'If acaddoc.ActiveSpace = acPaperSpace Then
'acaddoc.ActiveSpace = acModelSpace
'End If
Case 7
Exit Sub
End Select
'acadApp.ActiveDocument.SendCommand ("wew ")
''CALL NEXT PROCEDURE TO RUN, SPECIFYING HOW MANY RECORDS HAVE BEEN SAVED
'Call Start_Drawing(int_)
End Sub
Sub Talk_CAD()
'SUB PROCEDURE, REQUIRES INPUT STRING TO RUN AND GIVES SPECIFIC COMMAND TO AUTOCAD
'acadApp.ActiveDocument.SendCommand ("-layer set AS_SURVEYED " & vbCrLf & "-color BYLAYER ")
'acadApp.ActiveDocument.SendCommand ("circle 50,50 50 ")
acadApp.ActiveDocument.SendCommand ("wew ")
End Sub
Whenever i click on "File", or "Window", or "Edit" on the autocad toolbar. It will freeze for a second and then the excel will close itself and then open again in auto-saved mode. I took the code from the internet. I don't know what's causing the crash. Do you have any idea why?